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
n View
n ViewControl
n VInspector
+n Express
+t TKExpress
+x ExpToCasExe
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
}
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 {}
}
- }
- }
+# }
+# }
}
}
}
# 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
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 occurrences 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
lappend aVcFiles "$aCommonSettingsFile"
}
- }
+# }
return $aVcFiles
}
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} ""]
--- /dev/null
+project(ExpToCasExe)
+
+set (EXECUTABLE_PROJECT ON)
+OCCT_INCLUDE_CMAKE_FILE (adm/cmake/occt_toolkit)
+unset (EXECUTABLE_PROJECT)
--- /dev/null
+TKernel
+TKExpress
--- /dev/null
+// Created: Mon Nov 1 12:50:27 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 <string.h>
+#include <ctype.h>
+#include <time.h>
+
+#include <TCollection_HAsciiString.hxx>
+#include <TColStd_SequenceOfInteger.hxx>
+
+#include <Express_Schema.hxx>
+#include <Express_Item.hxx>
+
+#ifdef _MSC_VER
+#pragma warning(push)
+#pragma warning (disable:4267)
+#pragma warning (disable:4706)
+#endif
+
+Handle(Express_Schema) ec_parse(const char* theFileName); // 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 = 0;
+ 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> [start_index]]]" << 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;
+ std::cout << "- start_index - a first number for auxiliary generated files with data" << std::endl;
+ std::cout << " to copy into StepAP214_Protocol.cxx, RWStepAP214_GeneralModule.cxx and"
+ <<" RWStepAP214_ReadWriteModule.cxx" << 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(argv[1]);
+ 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;
+ }
+ }
+
+ Standard_Integer anIndex = -1;
+ if (argc > 4)
+ {
+ anIndex = atoi(argv[4]);
+ }
+
+ //=================================
+ // 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;
+ Express_Item::SetIndex(anIndex);
+ 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;
+}
+#ifdef _MSC_VER
+#pragma warning(pop)
+#endif
--- /dev/null
+exptocas.lex
+expltocas.yacc
+lex.exptocas.cxx
+exptocas.tab.hxx
+exptocas.tab.cxx
+ExpToCasExe.cxx
+
--- /dev/null
+// -*-C++-*-
+// FlexLexer.h -- define interfaces for lexical analyzer classes generated
+// by flex
+
+// Copyright (c) 1993 The Regents of the University of California.
+// All rights reserved.
+//
+// This code is derived from software contributed to Berkeley by
+// Kent Williams and Tom Epperly.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions
+// are met:
+
+// 1. Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+
+// Neither the name of the University nor the names of its contributors
+// may be used to endorse or promote products derived from this software
+// without specific prior written permission.
+
+// THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
+// IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
+// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+// PURPOSE.
+
+// This file defines FlexLexer, an abstract class which specifies the
+// external interface provided to flex C++ lexer objects, and yyFlexLexer,
+// which defines a particular lexer class.
+//
+// If you want to create multiple lexer classes, you use the -P flag
+// to rename each yyFlexLexer to some other xxFlexLexer. You then
+// include <FlexLexer.h> in your other sources once per lexer class:
+//
+// #undef yyFlexLexer
+// #define yyFlexLexer xxFlexLexer
+// #include <FlexLexer.h>
+//
+// #undef yyFlexLexer
+// #define yyFlexLexer zzFlexLexer
+// #include <FlexLexer.h>
+// ...
+
+#ifndef __FLEX_LEXER_H
+// Never included before - need to define base class.
+#define __FLEX_LEXER_H
+
+#include <iostream>
+
+extern "C++" {
+
+struct yy_buffer_state;
+typedef int yy_state_type;
+
+class FlexLexer
+{
+public:
+ virtual ~FlexLexer() { }
+
+ const char* YYText() const { return yytext; }
+ int YYLeng() const { return yyleng; }
+
+ virtual void
+ yy_switch_to_buffer( yy_buffer_state* new_buffer ) = 0;
+ virtual yy_buffer_state* yy_create_buffer( std::istream* s, int size ) = 0;
+ virtual yy_buffer_state* yy_create_buffer( std::istream& s, int size ) = 0;
+ virtual void yy_delete_buffer( yy_buffer_state* b ) = 0;
+ virtual void yyrestart( std::istream* s ) = 0;
+ virtual void yyrestart( std::istream& s ) = 0;
+
+ virtual int yylex() = 0;
+
+ // Call yylex with new input/output sources.
+ int yylex( std::istream& new_in, std::ostream& new_out )
+ {
+ switch_streams( new_in, new_out );
+ return yylex();
+ }
+
+ int yylex( std::istream* new_in, std::ostream* new_out = 0)
+ {
+ switch_streams( new_in, new_out );
+ return yylex();
+ }
+
+ // Switch to new input/output streams. A nil stream pointer
+ // indicates "keep the current one".
+ virtual void switch_streams( std::istream* new_in,
+ std::ostream* new_out ) = 0;
+ virtual void switch_streams( std::istream& new_in,
+ std::ostream& new_out ) = 0;
+
+ int lineno() const { return yylineno; }
+
+ int debug() const { return yy_flex_debug; }
+ void set_debug( int flag ) { yy_flex_debug = flag; }
+
+protected:
+ char* yytext;
+ int yyleng;
+ int yylineno; // only maintained if you use %option yylineno
+ int yy_flex_debug; // only has effect with -d or "%option debug"
+};
+
+}
+#endif // FLEXLEXER_H
+
+#if defined(yyFlexLexer) || ! defined(yyFlexLexerOnce)
+// Either this is the first time through (yyFlexLexerOnce not defined),
+// or this is a repeated include to define a different flavor of
+// yyFlexLexer, as discussed in the flex manual.
+# define yyFlexLexerOnce
+
+extern "C++" {
+
+class yyFlexLexer : public FlexLexer {
+public:
+ // arg_yyin and arg_yyout default to the cin and cout, but we
+ // only make that assignment when initializing in yylex().
+ yyFlexLexer( std::istream& arg_yyin, std::ostream& arg_yyout );
+ yyFlexLexer( std::istream* arg_yyin = 0, std::ostream* arg_yyout = 0 );
+private:
+ void ctor_common();
+
+public:
+
+ virtual ~yyFlexLexer();
+
+ void yy_switch_to_buffer( yy_buffer_state* new_buffer );
+ yy_buffer_state* yy_create_buffer( std::istream* s, int size );
+ yy_buffer_state* yy_create_buffer( std::istream& s, int size );
+ void yy_delete_buffer( yy_buffer_state* b );
+ void yyrestart( std::istream* s );
+ void yyrestart( std::istream& s );
+
+ void yypush_buffer_state( yy_buffer_state* new_buffer );
+ void yypop_buffer_state();
+
+ virtual int yylex();
+ virtual void switch_streams( std::istream& new_in, std::ostream& new_out );
+ virtual void switch_streams( std::istream* new_in = 0, std::ostream* new_out = 0 );
+ virtual int yywrap();
+
+protected:
+ virtual int LexerInput( char* buf, int max_size );
+ virtual void LexerOutput( const char* buf, int size );
+ virtual void LexerError( const char* msg );
+
+ void yyunput( int c, char* buf_ptr );
+ int yyinput();
+
+ void yy_load_buffer_state();
+ void yy_init_buffer( yy_buffer_state* b, std::istream& s );
+ void yy_flush_buffer( yy_buffer_state* b );
+
+ int yy_start_stack_ptr;
+ int yy_start_stack_depth;
+ int* yy_start_stack;
+
+ void yy_push_state( int new_state );
+ void yy_pop_state();
+ int yy_top_state();
+
+ yy_state_type yy_get_previous_state();
+ yy_state_type yy_try_NUL_trans( yy_state_type current_state );
+ int yy_get_next_buffer();
+
+ std::istream yyin; // input source for default LexerInput
+ std::ostream yyout; // output sink for default LexerOutput
+
+ // yy_hold_char holds the character lost when yytext is formed.
+ char yy_hold_char;
+
+ // Number of characters read into yy_ch_buf.
+ int yy_n_chars;
+
+ // Points to current character in buffer.
+ char* yy_c_buf_p;
+
+ int yy_init; // whether we need to initialize
+ int yy_start; // start state number
+
+ // Flag which is used to allow yywrap()'s to do buffer switches
+ // instead of setting up a fresh yyin. A bit of a hack ...
+ int yy_did_buffer_switch_on_eof;
+
+
+ size_t yy_buffer_stack_top; /**< index of top of stack. */
+ size_t yy_buffer_stack_max; /**< capacity of stack. */
+ yy_buffer_state ** yy_buffer_stack; /**< Stack as an array. */
+ void yyensure_buffer_stack(void);
+
+ // The following are not always needed, but may be depending
+ // on use of certain flex features (like REJECT or yymore()).
+
+ yy_state_type yy_last_accepting_state;
+ char* yy_last_accepting_cpos;
+
+ yy_state_type* yy_state_buf;
+ yy_state_type* yy_state_ptr;
+
+ char* yy_full_match;
+ int* yy_full_state;
+ int yy_full_lp;
+
+ int yy_lp;
+ int yy_looking_for_trail_begin;
+
+ int yy_more_flag;
+ int yy_more_len;
+ int yy_more_offset;
+ int yy_prev_more_offset;
+};
+
+}
+
+#endif // yyFlexLexer || ! yyFlexLexerOnce
--- /dev/null
+%{
+
+// Created: Thu Oct 28 12:21:16 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.
+
+/*****************************************************************************
+
+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 <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 "exptocas.tab.hxx" /* 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 ( const std::string& s, const std::string& text )
+{
+ printf ( "\nError at line %d: %s \"%s\"\n", ec_curline(), s.c_str(), text.c_str() );
+ return 0;
+}
+
+%}
+
+/*
+ c++ generate C++ parser class
+*/
+%option c++
+%option noyywrap
+%option yyclass="exptocas::scanner"
+%option debug
+%option nounistd
+
+%s TYP ENT
+%x COMM SKP RULE FUN
+
+%a 4000
+%o 6000
+
+%top{
+// Pre-include stdlib.h to avoid redefinition of integer type macros (INT8_MIN and similar in generated code)
+#if !defined(_MSC_VER) || (_MSC_VER >= 1600) // Visual Studio 2010+
+#include "stdint.h"
+#endif
+}
+
+%{
+
+// Tell flex which function to define
+#ifdef YY_DECL
+# undef YY_DECL
+#endif
+#define YY_DECL int exptocas::scanner::lex (exptocas::parser::semantic_type* yylval)
+
+typedef exptocas::parser::token token;
+
+/************************************/
+/* Section 2 */
+/* parsing rules */
+%}
+
+%%
+
+"--".* { /* Eat line comments */ }
+"(*" { ec_state = YYSTATE; BEGIN(COMM); }
+<COMM>. { /* Eat multiline comments */ }
+<COMM>"*)" { BEGIN(ec_state); }
+
+"SCHEMA" { return yylval->num = token::KSCHEM; }
+"END_SCHEMA" { return yylval->num = token::KENDS; }
+
+"TYPE" { BEGIN(TYP); return yylval->num = token::KTYP; }
+<TYP,SKP>"END_TYPE" { BEGIN(0); return yylval->num = token::KENDT; }
+
+"ENTITY" { BEGIN(ENT); return yylval->num = token::KENT; }
+<ENT,SKP>"END_ENTITY" { BEGIN(0); return yylval->num = token::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 = token::KSEL; }
+"ENUMERATION" { return yylval->num = token::KENUM; }
+"LIST" { return yylval->num = token::KLIST; }
+"ARRAY" { return yylval->num = token::KARR; }
+"SET" { return yylval->num = token::KSET; }
+"BAG" { return yylval->num = token::KBAG; }
+"OF" { return yylval->num = token::KOF; }
+
+"NUMBER" { return yylval->num = token::KNUM; }
+"INTEGER" { return yylval->num = token::KINT; }
+"REAL" { return yylval->num = token::KDBL; }
+"STRING" { return yylval->num = token::KSTR; }
+"LOGICAL" { return yylval->num = token::KLOG; }
+"BOOLEAN" { return yylval->num = token::KBOOL; }
+
+"OPTIONAL" { return yylval->num = token::KOPT; }
+"UNIQUE" { return yylval->num = token::KUNIQ; }
+"SELF" { return yylval->num = token::KSELF; }
+
+"ABSTRACT" { return yylval->num = token::KABSTR; }
+"SUBTYPE" { return yylval->num = token::KSUBT; }
+"SUPERTYPE" { return yylval->num = token::KSPRT; }
+"ANDOR" { return yylval->num = token::KANDOR; }
+"ONEOF" { return yylval->num = token::K1OF; }
+"AND" { return yylval->num = token::KAND; }
+
+"UR"[0-9]+ { yylval->str = strdup ( yytext ); return token::NAME; }
+
+[a-z_][a-z_0-9]* { yylval->str = strdup ( yytext ); return token::NAME; }
+
+[0-9]+ { yylval->num = atoi ( yytext ); return token::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 */
+
+exptocas::scanner::scanner(std::istream* in, std::ostream* out)
+ : exptocasFlexLexer(in, out)
+{
+}
+
+/*
+int main ( void )
+{
+ yylex();
+}
+*/
+
--- /dev/null
+// A Bison parser, made by GNU Bison 3.7.1.
+
+// Skeleton implementation for Bison LALR(1) parsers in C++
+
+// Copyright (C) 2002-2015, 2018-2020 Free Software Foundation, Inc.
+
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+// As a special exception, you may create a larger work that contains
+// part or all of the Bison parser skeleton and distribute that work
+// under terms of your choice, so long as that work isn't itself a
+// parser generator using the skeleton or a modified version thereof
+// as a parser skeleton. Alternatively, if you modify or redistribute
+// the parser skeleton itself, you may (at your option) remove this
+// special exception, which will cause the skeleton and the resulting
+// Bison output files to be licensed under the GNU General Public
+// License without this special exception.
+
+// This special exception was added by the Free Software Foundation in
+// version 2.2 of Bison.
+
+// DO NOT RELY ON FEATURES THAT ARE NOT DOCUMENTED in the manual,
+// especially those whose name start with YY_ or yy_. They are
+// private implementation details that can be changed or removed.
+
+
+// Take the name prefix into account.
+#define yylex exptocaslex
+
+// First part of user prologue.
+
+
+// Created: Thu Oct 28 12:21:16 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.
+
+/*****************************************************************************
+
+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 <OSD_OpenFile.hxx>
+#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 exptocas.l) */
+int ec_error ( const std::string& s, const std::string& 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 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 );
+
+
+
+
+#include "exptocas.tab.hxx"
+
+
+// Unqualified %code blocks.
+
+#undef yylex
+#define yylex scanner->lex
+// disable MSVC warnings in bison code
+#ifdef _MSC_VER
+#pragma warning(disable:4244 4800)
+#endif
+
+
+
+#ifndef YY_
+# if defined YYENABLE_NLS && YYENABLE_NLS
+# if ENABLE_NLS
+# include <libintl.h> // FIXME: INFRINGES ON USER NAME SPACE.
+# define YY_(msgid) dgettext ("bison-runtime", msgid)
+# endif
+# endif
+# ifndef YY_
+# define YY_(msgid) msgid
+# endif
+#endif
+
+
+// Whether we are compiled with exception support.
+#ifndef YY_EXCEPTIONS
+# if defined __GNUC__ && !defined __EXCEPTIONS
+# define YY_EXCEPTIONS 0
+# else
+# define YY_EXCEPTIONS 1
+# endif
+#endif
+
+
+
+// Enable debugging if requested.
+#if YYDEBUG
+
+// A pseudo ostream that takes yydebug_ into account.
+# define YYCDEBUG if (yydebug_) (*yycdebug_)
+
+# define YY_SYMBOL_PRINT(Title, Symbol) \
+ do { \
+ if (yydebug_) \
+ { \
+ *yycdebug_ << Title << ' '; \
+ yy_print_ (*yycdebug_, Symbol); \
+ *yycdebug_ << '\n'; \
+ } \
+ } while (false)
+
+# define YY_REDUCE_PRINT(Rule) \
+ do { \
+ if (yydebug_) \
+ yy_reduce_print_ (Rule); \
+ } while (false)
+
+# define YY_STACK_PRINT() \
+ do { \
+ if (yydebug_) \
+ yy_stack_print_ (); \
+ } while (false)
+
+#else // !YYDEBUG
+
+# define YYCDEBUG if (false) std::cerr
+# define YY_SYMBOL_PRINT(Title, Symbol) YYUSE (Symbol)
+# define YY_REDUCE_PRINT(Rule) static_cast<void> (0)
+# define YY_STACK_PRINT() static_cast<void> (0)
+
+#endif // !YYDEBUG
+
+#define yyerrok (yyerrstatus_ = 0)
+#define yyclearin (yyla.clear ())
+
+#define YYACCEPT goto yyacceptlab
+#define YYABORT goto yyabortlab
+#define YYERROR goto yyerrorlab
+#define YYRECOVERING() (!!yyerrstatus_)
+
+namespace exptocas {
+
+ /// Build a parser object.
+ parser::parser (exptocas::scanner* scanner_yyarg)
+#if YYDEBUG
+ : yydebug_ (false),
+ yycdebug_ (&std::cerr),
+#else
+ :
+#endif
+ scanner (scanner_yyarg)
+ {}
+
+ parser::~parser ()
+ {}
+
+ parser::syntax_error::~syntax_error () YY_NOEXCEPT YY_NOTHROW
+ {}
+
+ /*---------------.
+ | symbol kinds. |
+ `---------------*/
+
+ // basic_symbol.
+ template <typename Base>
+ parser::basic_symbol<Base>::basic_symbol (const basic_symbol& that)
+ : Base (that)
+ , value (that.value)
+ {}
+
+
+ /// Constructor for valueless symbols.
+ template <typename Base>
+ parser::basic_symbol<Base>::basic_symbol (typename Base::kind_type t)
+ : Base (t)
+ , value ()
+ {}
+
+ template <typename Base>
+ parser::basic_symbol<Base>::basic_symbol (typename Base::kind_type t, YY_RVREF (semantic_type) v)
+ : Base (t)
+ , value (YY_MOVE (v))
+ {}
+
+ template <typename Base>
+ parser::symbol_kind_type
+ parser::basic_symbol<Base>::type_get () const YY_NOEXCEPT
+ {
+ return this->kind ();
+ }
+
+ template <typename Base>
+ bool
+ parser::basic_symbol<Base>::empty () const YY_NOEXCEPT
+ {
+ return this->kind () == symbol_kind::S_YYEMPTY;
+ }
+
+ template <typename Base>
+ void
+ parser::basic_symbol<Base>::move (basic_symbol& s)
+ {
+ super_type::move (s);
+ value = YY_MOVE (s.value);
+ }
+
+ // by_kind.
+ parser::by_kind::by_kind ()
+ : kind_ (symbol_kind::S_YYEMPTY)
+ {}
+
+#if 201103L <= YY_CPLUSPLUS
+ parser::by_kind::by_kind (by_kind&& that)
+ : kind_ (that.kind_)
+ {
+ that.clear ();
+ }
+#endif
+
+ parser::by_kind::by_kind (const by_kind& that)
+ : kind_ (that.kind_)
+ {}
+
+ parser::by_kind::by_kind (token_kind_type t)
+ : kind_ (yytranslate_ (t))
+ {}
+
+ void
+ parser::by_kind::clear ()
+ {
+ kind_ = symbol_kind::S_YYEMPTY;
+ }
+
+ void
+ parser::by_kind::move (by_kind& that)
+ {
+ kind_ = that.kind_;
+ that.clear ();
+ }
+
+ parser::symbol_kind_type
+ parser::by_kind::kind () const YY_NOEXCEPT
+ {
+ return kind_;
+ }
+
+ parser::symbol_kind_type
+ parser::by_kind::type_get () const YY_NOEXCEPT
+ {
+ return this->kind ();
+ }
+
+
+ // by_state.
+ parser::by_state::by_state () YY_NOEXCEPT
+ : state (empty_state)
+ {}
+
+ parser::by_state::by_state (const by_state& that) YY_NOEXCEPT
+ : state (that.state)
+ {}
+
+ void
+ parser::by_state::clear () YY_NOEXCEPT
+ {
+ state = empty_state;
+ }
+
+ void
+ parser::by_state::move (by_state& that)
+ {
+ state = that.state;
+ that.clear ();
+ }
+
+ parser::by_state::by_state (state_type s) YY_NOEXCEPT
+ : state (s)
+ {}
+
+ parser::symbol_kind_type
+ parser::by_state::kind () const YY_NOEXCEPT
+ {
+ if (state == empty_state)
+ return symbol_kind::S_YYEMPTY;
+ else
+ return YY_CAST (symbol_kind_type, yystos_[+state]);
+ }
+
+ parser::stack_symbol_type::stack_symbol_type ()
+ {}
+
+ parser::stack_symbol_type::stack_symbol_type (YY_RVREF (stack_symbol_type) that)
+ : super_type (YY_MOVE (that.state), YY_MOVE (that.value))
+ {
+#if 201103L <= YY_CPLUSPLUS
+ // that is emptied.
+ that.state = empty_state;
+#endif
+ }
+
+ parser::stack_symbol_type::stack_symbol_type (state_type s, YY_MOVE_REF (symbol_type) that)
+ : super_type (s, YY_MOVE (that.value))
+ {
+ // that is emptied.
+ that.kind_ = symbol_kind::S_YYEMPTY;
+ }
+
+#if YY_CPLUSPLUS < 201103L
+ parser::stack_symbol_type&
+ parser::stack_symbol_type::operator= (const stack_symbol_type& that)
+ {
+ state = that.state;
+ value = that.value;
+ return *this;
+ }
+
+ parser::stack_symbol_type&
+ parser::stack_symbol_type::operator= (stack_symbol_type& that)
+ {
+ state = that.state;
+ value = that.value;
+ // that is emptied.
+ that.state = empty_state;
+ return *this;
+ }
+#endif
+
+ template <typename Base>
+ void
+ parser::yy_destroy_ (const char* yymsg, basic_symbol<Base>& yysym) const
+ {
+ if (yymsg)
+ YY_SYMBOL_PRINT (yymsg, yysym);
+
+ // User destructor.
+ YYUSE (yysym.kind ());
+ }
+
+#if YYDEBUG
+ template <typename Base>
+ void
+ parser::yy_print_ (std::ostream& yyo, const basic_symbol<Base>& yysym) const
+ {
+ std::ostream& yyoutput = yyo;
+ YYUSE (yyoutput);
+ if (yysym.empty ())
+ yyo << "empty symbol";
+ else
+ {
+ symbol_kind_type yykind = yysym.kind ();
+ yyo << (yykind < YYNTOKENS ? "token" : "nterm")
+ << ' ' << yysym.name () << " (";
+ YYUSE (yykind);
+ yyo << ')';
+ }
+ }
+#endif
+
+ void
+ parser::yypush_ (const char* m, YY_MOVE_REF (stack_symbol_type) sym)
+ {
+ if (m)
+ YY_SYMBOL_PRINT (m, sym);
+ yystack_.push (YY_MOVE (sym));
+ }
+
+ void
+ parser::yypush_ (const char* m, state_type s, YY_MOVE_REF (symbol_type) sym)
+ {
+#if 201103L <= YY_CPLUSPLUS
+ yypush_ (m, stack_symbol_type (s, std::move (sym)));
+#else
+ stack_symbol_type ss (s, sym);
+ yypush_ (m, ss);
+#endif
+ }
+
+ void
+ parser::yypop_ (int n)
+ {
+ yystack_.pop (n);
+ }
+
+#if YYDEBUG
+ std::ostream&
+ parser::debug_stream () const
+ {
+ return *yycdebug_;
+ }
+
+ void
+ parser::set_debug_stream (std::ostream& o)
+ {
+ yycdebug_ = &o;
+ }
+
+
+ parser::debug_level_type
+ parser::debug_level () const
+ {
+ return yydebug_;
+ }
+
+ void
+ parser::set_debug_level (debug_level_type l)
+ {
+ yydebug_ = l;
+ }
+#endif // YYDEBUG
+
+ parser::state_type
+ parser::yy_lr_goto_state_ (state_type yystate, int yysym)
+ {
+ int yyr = yypgoto_[yysym - YYNTOKENS] + yystate;
+ if (0 <= yyr && yyr <= yylast_ && yycheck_[yyr] == yystate)
+ return yytable_[yyr];
+ else
+ return yydefgoto_[yysym - YYNTOKENS];
+ }
+
+ bool
+ parser::yy_pact_value_is_default_ (int yyvalue)
+ {
+ return yyvalue == yypact_ninf_;
+ }
+
+ bool
+ parser::yy_table_value_is_error_ (int yyvalue)
+ {
+ return yyvalue == yytable_ninf_;
+ }
+
+ int
+ parser::operator() ()
+ {
+ return parse ();
+ }
+
+ int
+ parser::parse ()
+ {
+ int yyn;
+ /// Length of the RHS of the rule being reduced.
+ int yylen = 0;
+
+ // Error handling.
+ int yynerrs_ = 0;
+ int yyerrstatus_ = 0;
+
+ /// The lookahead symbol.
+ symbol_type yyla;
+
+ /// The return value of parse ().
+ int yyresult;
+
+#if YY_EXCEPTIONS
+ try
+#endif // YY_EXCEPTIONS
+ {
+ YYCDEBUG << "Starting parse\n";
+
+
+ /* Initialize the stack. The initial state will be set in
+ yynewstate, since the latter expects the semantical and the
+ location values to have been already stored, initialize these
+ stacks with a primary value. */
+ yystack_.clear ();
+ yypush_ (YY_NULLPTR, 0, YY_MOVE (yyla));
+
+ /*-----------------------------------------------.
+ | yynewstate -- push a new symbol on the stack. |
+ `-----------------------------------------------*/
+ yynewstate:
+ YYCDEBUG << "Entering state " << int (yystack_[0].state) << '\n';
+ YY_STACK_PRINT ();
+
+ // Accept?
+ if (yystack_[0].state == yyfinal_)
+ YYACCEPT;
+
+ goto yybackup;
+
+
+ /*-----------.
+ | yybackup. |
+ `-----------*/
+ yybackup:
+ // Try to take a decision without lookahead.
+ yyn = yypact_[+yystack_[0].state];
+ if (yy_pact_value_is_default_ (yyn))
+ goto yydefault;
+
+ // Read a lookahead token.
+ if (yyla.empty ())
+ {
+ YYCDEBUG << "Reading a token\n";
+#if YY_EXCEPTIONS
+ try
+#endif // YY_EXCEPTIONS
+ {
+ yyla.kind_ = yytranslate_ (yylex (&yyla.value));
+ }
+#if YY_EXCEPTIONS
+ catch (const syntax_error& yyexc)
+ {
+ YYCDEBUG << "Caught exception: " << yyexc.what() << '\n';
+ error (yyexc);
+ goto yyerrlab1;
+ }
+#endif // YY_EXCEPTIONS
+ }
+ YY_SYMBOL_PRINT ("Next token is", yyla);
+
+ if (yyla.kind () == symbol_kind::S_YYerror)
+ {
+ // The scanner already issued an error message, process directly
+ // to error recovery. But do not keep the error token as
+ // lookahead, it is too special and may lead us to an endless
+ // loop in error recovery. */
+ yyla.kind_ = symbol_kind::S_YYUNDEF;
+ goto yyerrlab1;
+ }
+
+ /* If the proper action on seeing token YYLA.TYPE is to reduce or
+ to detect an error, take that action. */
+ yyn += yyla.kind ();
+ if (yyn < 0 || yylast_ < yyn || yycheck_[yyn] != yyla.kind ())
+ {
+ goto yydefault;
+ }
+
+ // Reduce or error.
+ yyn = yytable_[yyn];
+ if (yyn <= 0)
+ {
+ if (yy_table_value_is_error_ (yyn))
+ goto yyerrlab;
+ yyn = -yyn;
+ goto yyreduce;
+ }
+
+ // Count tokens shifted since error; after three, turn off error status.
+ if (yyerrstatus_)
+ --yyerrstatus_;
+
+ // Shift the lookahead token.
+ yypush_ ("Shifting", state_type (yyn), YY_MOVE (yyla));
+ goto yynewstate;
+
+
+ /*-----------------------------------------------------------.
+ | yydefault -- do the default action for the current state. |
+ `-----------------------------------------------------------*/
+ yydefault:
+ yyn = yydefact_[+yystack_[0].state];
+ if (yyn == 0)
+ goto yyerrlab;
+ goto yyreduce;
+
+
+ /*-----------------------------.
+ | yyreduce -- do a reduction. |
+ `-----------------------------*/
+ yyreduce:
+ yylen = yyr2_[yyn];
+ {
+ stack_symbol_type yylhs;
+ yylhs.state = yy_lr_goto_state_ (yystack_[yylen].state, yyr1_[yyn]);
+ /* If YYLEN is nonzero, implement the default value of the
+ action: '$$ = $1'. Otherwise, use the top of the stack.
+
+ Otherwise, the following line sets YYLHS.VALUE to garbage.
+ This behavior is undocumented and Bison users should not rely
+ upon it. */
+ if (yylen)
+ yylhs.value = yystack_[yylen - 1].value;
+ else
+ yylhs.value = yystack_[0].value;
+
+
+ // Perform the reduction.
+ YY_REDUCE_PRINT (yyn);
+#if YY_EXCEPTIONS
+ try
+#endif // YY_EXCEPTIONS
+ {
+ switch (yyn)
+ {
+ case 2: // SCHEMA: KSCHEM NAME ';' ILIST KENDS ';'
+ { (yylhs.value.schema) = mkschema ( (yystack_[4].value.str), (yystack_[2].value.ilist) ); /* Root: EXPRESS schema */ }
+ break;
+
+ case 3: // ILIST: ITEM
+ { (yylhs.value.ilist) = mkilist ( (yystack_[0].value.item), 0 ); /* list of items for schema */ }
+ break;
+
+ case 4: // ILIST: ITEM ILIST
+ { (yylhs.value.ilist) = mkilist ( (yystack_[1].value.item), (yystack_[0].value.ilist) ); }
+ break;
+
+ case 5: // ITEM: ENUM
+ { (yylhs.value.item) = (yystack_[0].value.item); }
+ break;
+
+ case 6: // ITEM: SELECT
+ { (yylhs.value.item) = (yystack_[0].value.item); }
+ break;
+
+ case 7: // ITEM: ALIAS
+ { (yylhs.value.item) = (yystack_[0].value.item); }
+ break;
+
+ case 9: // ITEM: ENTITY
+ { (yylhs.value.item) = (yystack_[0].value.item); /* item of schema (type definition) */ }
+ break;
+
+ case 10: // ENUM: KTYP NAME '=' KENUM KOF TLIST1 ';' KENDT ';'
+ { (yylhs.value.item) = mkenum ( (yystack_[7].value.str), (yystack_[3].value.tlist) ); /* TYPE ENUMERATION definition */ }
+ break;
+
+ case 11: // SELECT: KTYP NAME '=' KSEL TLIST1 ';' KENDT ';'
+ { (yylhs.value.item) = mkselect ( (yystack_[6].value.str), (yystack_[3].value.tlist) ); /* TYPE SELECT definition */ }
+ break;
+
+ case 12: // ALIAS: KTYP NAME '=' TYPE ';' KENDT ';'
+ { (yylhs.value.item) = mkalias ( (yystack_[5].value.str), (yystack_[3].value.type) ); /* TYPE '=' definition (alias) */ }
+ break;
+
+ case 13: // ENTITY: KENT NAME SUPERT SUBT ';' FLIST1 UNIQUE KENDE ';'
+ { (yylhs.value.item) = mkentity ( (yystack_[7].value.str), (yystack_[5].value.tlist), (yystack_[3].value.flist), 0 ); /* ENTITY definition */ }
+ break;
+
+ case 14: // ENTITY: KENT NAME KABSTR SUPERT SUBT ';' FLIST1 UNIQUE KENDE ';'
+ { (yylhs.value.item) = mkentity ( (yystack_[8].value.str), (yystack_[5].value.tlist), (yystack_[3].value.flist), 1 ); /* ENTITY definition */ }
+ break;
+
+ case 15: // REFERENCE: KREF KFROM NAME TLIST1 ';'
+ { (yylhs.value.ref) = mkrefs ( (yystack_[2].value.str), (yystack_[1].value.tlist) ); /* REFERENCE FROM definition */ }
+ break;
+
+ case 16: // TLIST: NAME
+ { (yylhs.value.tlist) = mktlist ( (yystack_[0].value.str), 0 ); /* list of (type) names */ }
+ break;
+
+ case 17: // TLIST: NAME ',' TLIST
+ { (yylhs.value.tlist) = mktlist ( (yystack_[2].value.str), (yystack_[0].value.tlist) ); }
+ break;
+
+ case 18: // TLIST1: '(' TLIST ')'
+ { (yylhs.value.tlist) = (yystack_[1].value.tlist); /* TLIST in brackets */ }
+ break;
+
+ case 19: // TYPE: TSTD
+ { (yylhs.value.type) = (yystack_[0].value.type); }
+ break;
+
+ case 20: // TYPE: TNAME
+ { (yylhs.value.type) = (yystack_[0].value.type); }
+ break;
+
+ case 21: // TYPE: TSET
+ { (yylhs.value.type) = (yystack_[0].value.type); /* type, simple or complex */ }
+ break;
+
+ case 22: // TSTD: KINT
+ { (yylhs.value.type) = mktstd ( (yystack_[0].value.num) ); /* predefined type: INTEGER */ }
+ break;
+
+ case 23: // TSTD: KNUM
+ { (yylhs.value.type) = mktstd ( (yystack_[0].value.num) ); /* predefined type: NUMBER */ }
+ break;
+
+ case 24: // TSTD: KDBL
+ { (yylhs.value.type) = mktstd ( (yystack_[0].value.num) ); /* predefined type: REAL */ }
+ break;
+
+ case 25: // TSTD: KSTR
+ { (yylhs.value.type) = mktstd ( (yystack_[0].value.num) ); /* predefined type: STRING */ }
+ break;
+
+ case 26: // TSTD: KLOG
+ { (yylhs.value.type) = mktstd ( (yystack_[0].value.num) ); /* predefined type: LOGICAL */ }
+ break;
+
+ case 27: // TSTD: KBOOL
+ { (yylhs.value.type) = mktstd ( (yystack_[0].value.num) ); /* predefined type: BOOLEAN */ }
+ break;
+
+ case 28: // TNAME: NAME
+ { (yylhs.value.type) = mktname ( (yystack_[0].value.str) ); /* named type */ }
+ break;
+
+ case 29: // TSET: KLIST '[' INDEX ':' INDEX ']' KOF OPTUNI TYPE
+ { (yylhs.value.type) = mktset ( (yystack_[8].value.num), (yystack_[6].value.num), (yystack_[4].value.num), (yystack_[0].value.type) ); /* complex type: LIST */ }
+ break;
+
+ case 30: // TSET: KARR '[' INDEX ':' INDEX ']' KOF OPTUNI TYPE
+ { (yylhs.value.type) = mktset ( (yystack_[8].value.num), (yystack_[6].value.num), (yystack_[4].value.num), (yystack_[0].value.type) ); /* complex type: ARRAY */ }
+ break;
+
+ case 31: // TSET: KSET '[' INDEX ':' INDEX ']' KOF OPTUNI TYPE
+ { (yylhs.value.type) = mktset ( (yystack_[8].value.num), (yystack_[6].value.num), (yystack_[4].value.num), (yystack_[0].value.type) ); /* complex type: SET */ }
+ break;
+
+ case 32: // TSET: KBAG '[' INDEX ':' INDEX ']' KOF OPTUNI TYPE
+ { (yylhs.value.type) = mktset ( (yystack_[8].value.num), (yystack_[6].value.num), (yystack_[4].value.num), (yystack_[0].value.type) ); /* complex type: BAG */ }
+ break;
+
+ case 33: // INDEX: NUMBER
+ { (yylhs.value.num) = (yystack_[0].value.num); /* index for array, set, bag, list range */ }
+ break;
+
+ case 34: // INDEX: '?'
+ { (yylhs.value.num) = -1; /* undefined */ }
+ break;
+
+ case 35: // INDEX: NAME '(' NAME ')'
+ {(yylhs.value.num) = -1; printf ( "Warning at line %d: index function %s(%s) ignored\n", ec_curline(), (yystack_[3].value.str), (yystack_[1].value.str) ); /* some function.. */ }
+ break;
+
+ case 36: // OPTUNI: %empty
+ { (yylhs.value.num) = 0; /* UNIQUE keyword for complex type definition */ }
+ break;
+
+ case 37: // OPTUNI: KUNIQ
+ { (yylhs.value.num) = 1; }
+ break;
+
+ case 38: // SUBT: %empty
+ { (yylhs.value.tlist) = NULL; /* no subtype clause */ }
+ break;
+
+ case 39: // SUBT: KSUBT KOF TLIST1
+ { (yylhs.value.tlist) = (yystack_[0].value.tlist); /* subtype clause */ }
+ break;
+
+ case 40: // SUPERT: %empty
+ { (yylhs.value.num) = 0; /* no supertype clause */ }
+ break;
+
+ case 41: // SUPERT: KSPRT
+ { (yylhs.value.num) = 0; /* supertype clause (ignored) */ }
+ break;
+
+ case 42: // SUPERT: KSPRT KOF SUPLST
+ { (yylhs.value.num) = 0; /* supertype clause (ignored) */ }
+ break;
+
+ case 43: // SUPLST: NAME
+ { (yylhs.value.num) = 0; /* simple list of supertypes */ }
+ break;
+
+ case 44: // SUPLST: '(' SUPLST ')'
+ { (yylhs.value.num) = 0; /* allow bracketing */ }
+ break;
+
+ case 45: // SUPLST: NAME ',' SUPLST
+ { (yylhs.value.num) = 0; /* ... */ }
+ break;
+
+ case 46: // SUPLST: K1OF SUPLST
+ { (yylhs.value.num) = 0; /* ONEOF construct */ }
+ break;
+
+ case 47: // SUPLST: SUPLST KANDOR SUPLST
+ { (yylhs.value.num) = 0; /* ANDOR construct */ }
+ break;
+
+ case 48: // FLIST: FIELD
+ { (yylhs.value.flist) = mkflist ( (yystack_[0].value.field), 0 ); /* list of fields of ENTITY item */ }
+ break;
+
+ case 49: // FLIST: FIELD FLIST
+ { (yylhs.value.flist) = mkflist ( (yystack_[1].value.field), (yystack_[0].value.flist) ); }
+ break;
+
+ case 50: // FLIST: REDEF
+ { (yylhs.value.flist) = 0; /* redefinition of inherited field, just skip */ }
+ break;
+
+ case 51: // FLIST: REDEF FLIST
+ { (yylhs.value.flist) = (yystack_[0].value.flist); /* ignore redefinition of inherited field, take trailing list */ }
+ break;
+
+ case 52: // FLIST1: %empty
+ { (yylhs.value.flist) = NULL; /* empty list of fields */ }
+ break;
+
+ case 53: // FLIST1: FLIST
+ { (yylhs.value.flist) = (yystack_[0].value.flist); /* or not empty.. just to fix reduce/reduce conflict */ }
+ break;
+
+ case 54: // FIELD: NAME ':' OPTNL TYPE ';'
+ { (yylhs.value.field) = mkfield ( (yystack_[4].value.str), (yystack_[1].value.type), (yystack_[2].value.num) ); }
+ break;
+
+ case 55: // REDEF: KSELF '\\' SPECIF ':' TYPE ';'
+ { (yylhs.value.num) = 0; printf ( "Warning at line %d: field redefinition ignored\n", ec_curline() ); /* redefinition of inherited field */ }
+ break;
+
+ case 56: // SPECIF: NAME
+ { (yylhs.value.tlist) = mktlist ( (yystack_[0].value.str), 0 ); /* inherited field specification */ }
+ break;
+
+ case 57: // SPECIF: NAME '.' SPECIF
+ { (yylhs.value.tlist) = mktlist ( (yystack_[2].value.str), (yystack_[0].value.tlist) ); }
+ break;
+
+ case 58: // OPTNL: %empty
+ { (yylhs.value.num) = 0; }
+ break;
+
+ case 59: // OPTNL: KOPT
+ { (yylhs.value.num) = 1; }
+ break;
+
+ case 60: // UNIQIT: NAME ':' TLIST ';'
+ { (yylhs.value.tlist) = (yystack_[1].value.tlist); /* UNIQUE statement */ }
+ break;
+
+ case 61: // UNIQIT: NAME ':' SPCLST ';'
+ { (yylhs.value.tlist) = NULL; /* UNIQUE statement */ }
+ break;
+
+ case 62: // UNIQLS: UNIQIT
+ { (yylhs.value.tlist) = NULL; /* list of 1 UNIQUE statements */ }
+ break;
+
+ case 63: // UNIQLS: UNIQIT UNIQLS
+ { (yylhs.value.tlist) = mktlists ( (yystack_[1].value.tlist), (yystack_[0].value.tlist) );/* list of UNIQUE statements */ }
+ break;
+
+ case 64: // UNIQUE: %empty
+ { (yylhs.value.tlist) = NULL; /* no UNIQUE clause in ENTITY */ }
+ break;
+
+ case 65: // UNIQUE: KUNIQ UNIQLS
+ { (yylhs.value.tlist) = (yystack_[0].value.tlist); /* UNIQUE clause in ENTITY */ }
+ break;
+
+ case 66: // SPCLST: KSELF '\\' SPECIF
+ { (yylhs.value.num) = 0; /* list of specifications */ }
+ break;
+
+ case 67: // SPCLST: KSELF '\\' SPECIF ',' SPCLST
+ { (yylhs.value.num) = 0; }
+ break;
+
+ case 68: // SPCLST: NAME ',' SPCLST
+ { (yylhs.value.num) = 0; }
+ break;
+
+
+
+ default:
+ break;
+ }
+ }
+#if YY_EXCEPTIONS
+ catch (const syntax_error& yyexc)
+ {
+ YYCDEBUG << "Caught exception: " << yyexc.what() << '\n';
+ error (yyexc);
+ YYERROR;
+ }
+#endif // YY_EXCEPTIONS
+ YY_SYMBOL_PRINT ("-> $$ =", yylhs);
+ yypop_ (yylen);
+ yylen = 0;
+
+ // Shift the result of the reduction.
+ yypush_ (YY_NULLPTR, YY_MOVE (yylhs));
+ }
+ goto yynewstate;
+
+
+ /*--------------------------------------.
+ | yyerrlab -- here on detecting error. |
+ `--------------------------------------*/
+ yyerrlab:
+ // If not already recovering from an error, report this error.
+ if (!yyerrstatus_)
+ {
+ ++yynerrs_;
+ std::string msg = YY_("syntax error");
+ error (YY_MOVE (msg));
+ }
+
+
+ if (yyerrstatus_ == 3)
+ {
+ /* If just tried and failed to reuse lookahead token after an
+ error, discard it. */
+
+ // Return failure if at end of input.
+ if (yyla.kind () == symbol_kind::S_YYEOF)
+ YYABORT;
+ else if (!yyla.empty ())
+ {
+ yy_destroy_ ("Error: discarding", yyla);
+ yyla.clear ();
+ }
+ }
+
+ // Else will try to reuse lookahead token after shifting the error token.
+ goto yyerrlab1;
+
+
+ /*---------------------------------------------------.
+ | yyerrorlab -- error raised explicitly by YYERROR. |
+ `---------------------------------------------------*/
+ yyerrorlab:
+ /* Pacify compilers when the user code never invokes YYERROR and
+ the label yyerrorlab therefore never appears in user code. */
+ if (false)
+ YYERROR;
+
+ /* Do not reclaim the symbols of the rule whose action triggered
+ this YYERROR. */
+ yypop_ (yylen);
+ yylen = 0;
+ YY_STACK_PRINT ();
+ goto yyerrlab1;
+
+
+ /*-------------------------------------------------------------.
+ | yyerrlab1 -- common code for both syntax error and YYERROR. |
+ `-------------------------------------------------------------*/
+ yyerrlab1:
+ yyerrstatus_ = 3; // Each real token shifted decrements this.
+ // Pop stack until we find a state that shifts the error token.
+ for (;;)
+ {
+ yyn = yypact_[+yystack_[0].state];
+ if (!yy_pact_value_is_default_ (yyn))
+ {
+ yyn += symbol_kind::S_YYerror;
+ if (0 <= yyn && yyn <= yylast_
+ && yycheck_[yyn] == symbol_kind::S_YYerror)
+ {
+ yyn = yytable_[yyn];
+ if (0 < yyn)
+ break;
+ }
+ }
+
+ // Pop the current state because it cannot handle the error token.
+ if (yystack_.size () == 1)
+ YYABORT;
+
+ yy_destroy_ ("Error: popping", yystack_[0]);
+ yypop_ ();
+ YY_STACK_PRINT ();
+ }
+ {
+ stack_symbol_type error_token;
+
+
+ // Shift the error token.
+ error_token.state = state_type (yyn);
+ yypush_ ("Shifting", YY_MOVE (error_token));
+ }
+ goto yynewstate;
+
+
+ /*-------------------------------------.
+ | yyacceptlab -- YYACCEPT comes here. |
+ `-------------------------------------*/
+ yyacceptlab:
+ yyresult = 0;
+ goto yyreturn;
+
+
+ /*-----------------------------------.
+ | yyabortlab -- YYABORT comes here. |
+ `-----------------------------------*/
+ yyabortlab:
+ yyresult = 1;
+ goto yyreturn;
+
+
+ /*-----------------------------------------------------.
+ | yyreturn -- parsing is finished, return the result. |
+ `-----------------------------------------------------*/
+ yyreturn:
+ if (!yyla.empty ())
+ yy_destroy_ ("Cleanup: discarding lookahead", yyla);
+
+ /* Do not reclaim the symbols of the rule whose action triggered
+ this YYABORT or YYACCEPT. */
+ yypop_ (yylen);
+ YY_STACK_PRINT ();
+ while (1 < yystack_.size ())
+ {
+ yy_destroy_ ("Cleanup: popping", yystack_[0]);
+ yypop_ ();
+ }
+
+ return yyresult;
+ }
+#if YY_EXCEPTIONS
+ catch (...)
+ {
+ YYCDEBUG << "Exception caught: cleaning lookahead and stack\n";
+ // Do not try to display the values of the reclaimed symbols,
+ // as their printers might throw an exception.
+ if (!yyla.empty ())
+ yy_destroy_ (YY_NULLPTR, yyla);
+
+ while (1 < yystack_.size ())
+ {
+ yy_destroy_ (YY_NULLPTR, yystack_[0]);
+ yypop_ ();
+ }
+ throw;
+ }
+#endif // YY_EXCEPTIONS
+ }
+
+ void
+ parser::error (const syntax_error& yyexc)
+ {
+ error (yyexc.what ());
+ }
+
+#if YYDEBUG || 0
+ const char *
+ parser::symbol_name (symbol_kind_type yysymbol)
+ {
+ return yytname_[yysymbol];
+ }
+#endif // #if YYDEBUG || 0
+
+
+
+
+
+ const short parser::yypact_ninf_ = -134;
+
+ const signed char parser::yytable_ninf_ = -1;
+
+ const short
+ parser::yypact_[] =
+ {
+ 24, 3, 51, 5, -134, 73, 20, 34, 60, 70,
+ 73, -134, -134, -134, -134, -134, 42, 44, 47, 48,
+ -134, -1, 54, 68, 58, 49, -134, 49, 72, 50,
+ 52, 53, 55, -134, -134, -134, -134, -134, -134, -134,
+ 61, -134, -134, -134, 58, 38, 74, 62, 65, 64,
+ 66, 49, -8, -8, -8, -8, 88, 67, 38, 69,
+ 38, 71, 49, 12, 75, 57, -134, 99, 76, -134,
+ 77, -134, 78, 79, 80, 81, 82, 12, -134, 38,
+ 1, 38, -134, 63, 83, -134, 84, 12, 12, 65,
+ -134, 87, 100, 91, -8, -8, -8, -8, -134, 84,
+ -134, -134, -134, 92, 89, 93, 103, -134, -134, -134,
+ -134, 94, 90, 86, 95, 96, 97, 106, 98, 101,
+ -134, 43, 104, 93, -134, 105, -134, -134, 114, 115,
+ 116, 117, 108, 92, 43, 110, 26, -134, -134, 111,
+ 111, 111, 111, -134, -134, 112, -134, 107, 118, 113,
+ 119, -134, 43, 43, 43, 43, -134, 92, 26, -134,
+ -134, -134, -134, -134, -134, 121, -134, 41, 122, -134,
+ 41
+ };
+
+ const signed char
+ parser::yydefact_[] =
+ {
+ 0, 0, 0, 0, 1, 0, 0, 0, 0, 0,
+ 3, 5, 6, 7, 9, 8, 0, 40, 0, 0,
+ 4, 0, 40, 41, 38, 0, 2, 0, 0, 0,
+ 0, 0, 0, 23, 22, 24, 25, 26, 27, 28,
+ 0, 19, 20, 21, 38, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 43,
+ 0, 42, 0, 52, 16, 0, 15, 0, 0, 33,
+ 0, 34, 0, 0, 0, 0, 0, 52, 46, 0,
+ 0, 0, 39, 0, 0, 53, 64, 48, 50, 0,
+ 18, 0, 0, 0, 0, 0, 0, 0, 12, 64,
+ 45, 44, 47, 0, 58, 0, 0, 49, 51, 17,
+ 11, 0, 0, 0, 0, 0, 0, 0, 56, 0,
+ 59, 0, 0, 62, 65, 0, 10, 35, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 63, 13, 36,
+ 36, 36, 36, 14, 57, 0, 54, 0, 16, 0,
+ 0, 37, 0, 0, 0, 0, 55, 0, 0, 60,
+ 61, 29, 30, 32, 31, 66, 68, 0, 0, 67,
+ 0
+ };
+
+ const short
+ parser::yypgoto_[] =
+ {
+ -134, -134, 125, -134, -134, -134, -134, -134, -134, -48,
+ -23, -105, -134, -134, -134, -52, -133, 120, 128, -26,
+ -64, 31, -134, -134, -127, -134, -134, -7, 18, -131
+ };
+
+ const short
+ parser::yydefgoto_[] =
+ {
+ -1, 2, 9, 10, 11, 12, 13, 14, 15, 109,
+ 49, 40, 41, 42, 43, 72, 152, 47, 24, 61,
+ 85, 86, 87, 88, 119, 121, 123, 124, 106, 166
+ };
+
+ const unsigned char
+ parser::yytable_[] =
+ {
+ 65, 73, 74, 75, 50, 150, 144, 153, 154, 155,
+ 27, 28, 29, 30, 31, 32, 135, 33, 34, 35,
+ 36, 37, 38, 107, 108, 69, 70, 1, 68, 145,
+ 165, 81, 78, 39, 80, 71, 169, 3, 83, 82,
+ 101, 5, 113, 114, 115, 116, 84, 161, 162, 163,
+ 164, 4, 147, 100, 16, 102, 29, 30, 31, 32,
+ 148, 33, 34, 35, 36, 37, 38, 147, 17, 58,
+ 18, 22, 59, 23, 19, 168, 60, 39, 6, 21,
+ 7, 25, 8, 23, 26, 45, 46, 48, 149, 51,
+ 52, 62, 53, 54, 76, 55, 90, 56, 63, 64,
+ 66, 81, 67, 77, 79, 91, 111, 103, 99, 105,
+ 89, 125, 92, 120, 132, 93, 137, 117, 98, 94,
+ 95, 96, 97, 110, 104, 112, 118, 122, 128, 127,
+ 126, 139, 140, 141, 142, 20, 151, 129, 130, 131,
+ 0, 138, 134, 133, 143, 136, 146, 0, 156, 159,
+ 44, 157, 0, 158, 0, 160, 167, 170, 0, 0,
+ 0, 0, 0, 0, 57
+ };
+
+ const short
+ parser::yycheck_[] =
+ {
+ 48, 53, 54, 55, 27, 136, 133, 140, 141, 142,
+ 11, 12, 13, 14, 15, 16, 121, 18, 19, 20,
+ 21, 22, 23, 87, 88, 33, 34, 3, 51, 134,
+ 157, 30, 58, 34, 60, 43, 167, 34, 26, 62,
+ 39, 36, 94, 95, 96, 97, 34, 152, 153, 154,
+ 155, 0, 26, 79, 34, 81, 13, 14, 15, 16,
+ 34, 18, 19, 20, 21, 22, 23, 26, 34, 31,
+ 10, 27, 34, 29, 4, 34, 38, 34, 5, 37,
+ 7, 34, 9, 29, 36, 17, 28, 38, 136, 17,
+ 40, 17, 40, 40, 6, 40, 39, 36, 36, 34,
+ 36, 30, 36, 36, 35, 6, 6, 44, 77, 25,
+ 35, 8, 36, 24, 8, 38, 123, 99, 36, 41,
+ 41, 41, 41, 36, 41, 34, 34, 34, 42, 39,
+ 36, 17, 17, 17, 17, 10, 25, 42, 42, 42,
+ -1, 36, 41, 45, 36, 41, 36, -1, 36, 36,
+ 22, 44, -1, 35, -1, 36, 35, 35, -1, -1,
+ -1, -1, -1, -1, 44
+ };
+
+ const signed char
+ parser::yystos_[] =
+ {
+ 0, 3, 47, 34, 0, 36, 5, 7, 9, 48,
+ 49, 50, 51, 52, 53, 54, 34, 34, 10, 4,
+ 48, 37, 27, 29, 64, 34, 36, 11, 12, 13,
+ 14, 15, 16, 18, 19, 20, 21, 22, 23, 34,
+ 57, 58, 59, 60, 64, 17, 28, 63, 38, 56,
+ 56, 17, 40, 40, 40, 40, 36, 63, 31, 34,
+ 38, 65, 17, 36, 34, 55, 36, 36, 56, 33,
+ 34, 43, 61, 61, 61, 61, 6, 36, 65, 35,
+ 65, 30, 56, 26, 34, 66, 67, 68, 69, 35,
+ 39, 6, 36, 38, 41, 41, 41, 41, 36, 67,
+ 65, 39, 65, 44, 41, 25, 74, 66, 66, 55,
+ 36, 6, 34, 61, 61, 61, 61, 74, 34, 70,
+ 24, 71, 34, 72, 73, 8, 36, 39, 42, 42,
+ 42, 42, 8, 45, 41, 57, 41, 73, 36, 17,
+ 17, 17, 17, 36, 70, 57, 36, 26, 34, 55,
+ 75, 25, 62, 62, 62, 62, 36, 44, 35, 36,
+ 36, 57, 57, 57, 57, 70, 75, 35, 34, 75,
+ 35
+ };
+
+ const signed char
+ parser::yyr1_[] =
+ {
+ 0, 46, 47, 48, 48, 49, 49, 49, 49, 49,
+ 50, 51, 52, 53, 53, 54, 55, 55, 56, 57,
+ 57, 57, 58, 58, 58, 58, 58, 58, 59, 60,
+ 60, 60, 60, 61, 61, 61, 62, 62, 63, 63,
+ 64, 64, 64, 65, 65, 65, 65, 65, 66, 66,
+ 66, 66, 67, 67, 68, 69, 70, 70, 71, 71,
+ 72, 72, 73, 73, 74, 74, 75, 75, 75
+ };
+
+ const signed char
+ parser::yyr2_[] =
+ {
+ 0, 2, 6, 1, 2, 1, 1, 1, 1, 1,
+ 9, 8, 7, 9, 10, 5, 1, 3, 3, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 9,
+ 9, 9, 9, 1, 1, 4, 0, 1, 0, 3,
+ 0, 1, 3, 1, 3, 3, 2, 3, 1, 2,
+ 1, 2, 0, 1, 5, 6, 1, 3, 0, 1,
+ 4, 4, 1, 2, 0, 2, 3, 5, 3
+ };
+
+
+#if YYDEBUG
+ // YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
+ // First, the terminals, then, starting at \a YYNTOKENS, nonterminals.
+ const char*
+ const parser::yytname_[] =
+ {
+ "\"end of file\"", "error", "\"invalid token\"", "KSCHEM", "KENDS",
+ "KTYP", "KENDT", "KENT", "KENDE", "KREF", "KFROM", "KSEL", "KENUM",
+ "KLIST", "KARR", "KBAG", "KSET", "KOF", "KNUM", "KINT", "KDBL", "KSTR",
+ "KLOG", "KBOOL", "KOPT", "KUNIQ", "KSELF", "KABSTR", "KSUBT", "KSPRT",
+ "KANDOR", "K1OF", "KAND", "NUMBER", "NAME", "','", "';'", "'='", "'('",
+ "')'", "'['", "':'", "']'", "'?'", "'\\\\'", "'.'", "$accept", "SCHEMA",
+ "ILIST", "ITEM", "ENUM", "SELECT", "ALIAS", "ENTITY", "REFERENCE",
+ "TLIST", "TLIST1", "TYPE", "TSTD", "TNAME", "TSET", "INDEX", "OPTUNI",
+ "SUBT", "SUPERT", "SUPLST", "FLIST", "FLIST1", "FIELD", "REDEF",
+ "SPECIF", "OPTNL", "UNIQIT", "UNIQLS", "UNIQUE", "SPCLST", YY_NULLPTR
+ };
+#endif
+
+
+#if YYDEBUG
+ const short
+ parser::yyrline_[] =
+ {
+ 0, 219, 219, 221, 222, 225, 226, 227, 228, 229,
+ 231, 233, 235, 237, 238, 241, 244, 245, 247, 250,
+ 251, 252, 254, 255, 256, 257, 258, 259, 261, 263,
+ 264, 265, 266, 268, 269, 270, 272, 273, 276, 277,
+ 279, 280, 281, 283, 284, 285, 286, 287, 290, 291,
+ 292, 293, 295, 296, 298, 300, 302, 303, 306, 307,
+ 310, 311, 313, 314, 316, 317, 319, 320, 321
+ };
+
+ void
+ parser::yy_stack_print_ () const
+ {
+ *yycdebug_ << "Stack now";
+ for (stack_type::const_iterator
+ i = yystack_.begin (),
+ i_end = yystack_.end ();
+ i != i_end; ++i)
+ *yycdebug_ << ' ' << int (i->state);
+ *yycdebug_ << '\n';
+ }
+
+ void
+ parser::yy_reduce_print_ (int yyrule) const
+ {
+ int yylno = yyrline_[yyrule];
+ int yynrhs = yyr2_[yyrule];
+ // Print the symbols being reduced, and their result.
+ *yycdebug_ << "Reducing stack by rule " << yyrule - 1
+ << " (line " << yylno << "):\n";
+ // The symbols being reduced.
+ for (int yyi = 0; yyi < yynrhs; yyi++)
+ YY_SYMBOL_PRINT (" $" << yyi + 1 << " =",
+ yystack_[(yynrhs) - (yyi + 1)]);
+ }
+#endif // YYDEBUG
+
+ parser::symbol_kind_type
+ parser::yytranslate_ (int t)
+ {
+ // YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to
+ // TOKEN-NUM as returned by yylex.
+ static
+ const signed char
+ translate_table[] =
+ {
+ 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 38, 39, 2, 2, 35, 2, 45, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 41, 36,
+ 2, 37, 2, 43, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 40, 44, 42, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
+ 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
+ 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
+ 25, 26, 27, 28, 29, 30, 31, 32, 33, 34
+ };
+ // Last valid token kind.
+ const int code_max = 289;
+
+ if (t <= 0)
+ return symbol_kind::S_YYEOF;
+ else if (t <= code_max)
+ return YY_CAST (symbol_kind_type, translate_table[t]);
+ else
+ return symbol_kind::S_YYUNDEF;
+ }
+
+} // exptocas
+
+
+
+/************************************************/
+/* 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 exptocas::parser::token::KINT : return new Express_Integer;
+ case exptocas::parser::token::KNUM : return new Express_Number;
+ case exptocas::parser::token::KDBL : return new Express_Real;
+ case exptocas::parser::token::KSTR : return new Express_String;
+ case exptocas::parser::token::KBOOL: return new Express_Boolean;
+ case exptocas::parser::token::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 exptocas::parser::token::KLIST: return new Express_List ( ilow, ihigh, of );
+ case exptocas::parser::token::KARR : return new Express_Array ( ilow, ihigh, of );
+ case exptocas::parser::token::KBAG : return new Express_Bag ( ilow, ihigh, of );
+ case exptocas::parser::token::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(const char* theFileName)
+{
+ std::ifstream aFileStream;
+ OSD_OpenStream(aFileStream, theFileName, std::ios_base::in | std::ios_base::binary);
+ exptocas::scanner aScanner(&aFileStream);
+ aScanner.yyrestart(aFileStream);
+ // uncomment next string for debug of parser
+ //aScanner.set_debug(1);
+ exptocas::parser aParser(&aScanner);
+ aParser.parse();
+ 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;
+}
+*/
+
+void exptocas::parser::error(const std::string& s)
+{
+ printf("\nParse error at line %d: %s\n", scanner->lineno(), s.c_str());
+}
+
--- /dev/null
+// A Bison parser, made by GNU Bison 3.7.1.
+
+// Skeleton interface for Bison LALR(1) parsers in C++
+
+// Copyright (C) 2002-2015, 2018-2020 Free Software Foundation, Inc.
+
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+// As a special exception, you may create a larger work that contains
+// part or all of the Bison parser skeleton and distribute that work
+// under terms of your choice, so long as that work isn't itself a
+// parser generator using the skeleton or a modified version thereof
+// as a parser skeleton. Alternatively, if you modify or redistribute
+// the parser skeleton itself, you may (at your option) remove this
+// special exception, which will cause the skeleton and the resulting
+// Bison output files to be licensed under the GNU General Public
+// License without this special exception.
+
+// This special exception was added by the Free Software Foundation in
+// version 2.2 of Bison.
+
+
+/**
+ ** \file ExpToCasExe/exptocas.tab.hxx
+ ** Define the exptocas::parser class.
+ */
+
+// C++ LALR(1) parser skeleton written by Akim Demaille.
+
+// DO NOT RELY ON FEATURES THAT ARE NOT DOCUMENTED in the manual,
+// especially those whose name start with YY_ or yy_. They are
+// private implementation details that can be changed or removed.
+
+#ifndef YY_EXPTOCAS_EXPTOCASEXE_EXPTOCAS_TAB_HXX_INCLUDED
+# define YY_EXPTOCAS_EXPTOCASEXE_EXPTOCAS_TAB_HXX_INCLUDED
+// "%code requires" blocks.
+
+namespace exptocas {
+ class scanner;
+};
+#ifdef _MSC_VER
+// disable MSVC warning C4522: 'exptocas::parser::stack_symbol_type': multiple assignment operators
+#pragma warning(disable: 4522)
+#endif
+
+
+
+# include <cstdlib> // std::abort
+# include <iostream>
+# include <stdexcept>
+# include <string>
+# include <vector>
+
+#if defined __cplusplus
+# define YY_CPLUSPLUS __cplusplus
+#else
+# define YY_CPLUSPLUS 199711L
+#endif
+
+// Support move semantics when possible.
+#if 201103L <= YY_CPLUSPLUS
+# define YY_MOVE std::move
+# define YY_MOVE_OR_COPY move
+# define YY_MOVE_REF(Type) Type&&
+# define YY_RVREF(Type) Type&&
+# define YY_COPY(Type) Type
+#else
+# define YY_MOVE
+# define YY_MOVE_OR_COPY copy
+# define YY_MOVE_REF(Type) Type&
+# define YY_RVREF(Type) const Type&
+# define YY_COPY(Type) const Type&
+#endif
+
+// Support noexcept when possible.
+#if 201103L <= YY_CPLUSPLUS
+# define YY_NOEXCEPT noexcept
+# define YY_NOTHROW
+#else
+# define YY_NOEXCEPT
+# define YY_NOTHROW throw ()
+#endif
+
+// Support constexpr when possible.
+#if 201703 <= YY_CPLUSPLUS
+# define YY_CONSTEXPR constexpr
+#else
+# define YY_CONSTEXPR
+#endif
+
+
+
+#ifndef YY_ATTRIBUTE_PURE
+# if defined __GNUC__ && 2 < __GNUC__ + (96 <= __GNUC_MINOR__)
+# define YY_ATTRIBUTE_PURE __attribute__ ((__pure__))
+# else
+# define YY_ATTRIBUTE_PURE
+# endif
+#endif
+
+#ifndef YY_ATTRIBUTE_UNUSED
+# if defined __GNUC__ && 2 < __GNUC__ + (7 <= __GNUC_MINOR__)
+# define YY_ATTRIBUTE_UNUSED __attribute__ ((__unused__))
+# else
+# define YY_ATTRIBUTE_UNUSED
+# endif
+#endif
+
+/* Suppress unused-variable warnings by "using" E. */
+#if ! defined lint || defined __GNUC__
+# define YYUSE(E) ((void) (E))
+#else
+# define YYUSE(E) /* empty */
+#endif
+
+#if defined __GNUC__ && ! defined __ICC && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
+/* Suppress an incorrect diagnostic about yylval being uninitialized. */
+# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
+ _Pragma ("GCC diagnostic push") \
+ _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"") \
+ _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
+# define YY_IGNORE_MAYBE_UNINITIALIZED_END \
+ _Pragma ("GCC diagnostic pop")
+#else
+# define YY_INITIAL_VALUE(Value) Value
+#endif
+#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
+# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
+# define YY_IGNORE_MAYBE_UNINITIALIZED_END
+#endif
+#ifndef YY_INITIAL_VALUE
+# define YY_INITIAL_VALUE(Value) /* Nothing. */
+#endif
+
+#if defined __cplusplus && defined __GNUC__ && ! defined __ICC && 6 <= __GNUC__
+# define YY_IGNORE_USELESS_CAST_BEGIN \
+ _Pragma ("GCC diagnostic push") \
+ _Pragma ("GCC diagnostic ignored \"-Wuseless-cast\"")
+# define YY_IGNORE_USELESS_CAST_END \
+ _Pragma ("GCC diagnostic pop")
+#endif
+#ifndef YY_IGNORE_USELESS_CAST_BEGIN
+# define YY_IGNORE_USELESS_CAST_BEGIN
+# define YY_IGNORE_USELESS_CAST_END
+#endif
+
+# ifndef YY_CAST
+# ifdef __cplusplus
+# define YY_CAST(Type, Val) static_cast<Type> (Val)
+# define YY_REINTERPRET_CAST(Type, Val) reinterpret_cast<Type> (Val)
+# else
+# define YY_CAST(Type, Val) ((Type) (Val))
+# define YY_REINTERPRET_CAST(Type, Val) ((Type) (Val))
+# endif
+# endif
+# ifndef YY_NULLPTR
+# if defined __cplusplus
+# if 201103L <= __cplusplus
+# define YY_NULLPTR nullptr
+# else
+# define YY_NULLPTR 0
+# endif
+# else
+# define YY_NULLPTR ((void*)0)
+# endif
+# endif
+
+/* Debug traces. */
+#ifndef YYDEBUG
+# define YYDEBUG 1
+#endif
+
+namespace exptocas {
+
+
+
+
+ /// A Bison parser.
+ class parser
+ {
+ public:
+#ifndef YYSTYPE
+ /// Symbol semantic values.
+ union semantic_type
+ {
+
+ 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;
+
+
+ };
+#else
+ typedef YYSTYPE semantic_type;
+#endif
+
+ /// Syntax errors thrown from user actions.
+ struct syntax_error : std::runtime_error
+ {
+ syntax_error (const std::string& m)
+ : std::runtime_error (m)
+ {}
+
+ syntax_error (const syntax_error& s)
+ : std::runtime_error (s.what ())
+ {}
+
+ ~syntax_error () YY_NOEXCEPT YY_NOTHROW;
+ };
+
+ /// Token kinds.
+ struct token
+ {
+ enum token_kind_type
+ {
+ YYEMPTY = -2,
+ YYEOF = 0, // "end of file"
+ YYerror = 256, // error
+ YYUNDEF = 257, // "invalid token"
+ KSCHEM = 258, // KSCHEM
+ KENDS = 259, // KENDS
+ KTYP = 260, // KTYP
+ KENDT = 261, // KENDT
+ KENT = 262, // KENT
+ KENDE = 263, // KENDE
+ KREF = 264, // KREF
+ KFROM = 265, // KFROM
+ KSEL = 266, // KSEL
+ KENUM = 267, // KENUM
+ KLIST = 268, // KLIST
+ KARR = 269, // KARR
+ KBAG = 270, // KBAG
+ KSET = 271, // KSET
+ KOF = 272, // KOF
+ KNUM = 273, // KNUM
+ KINT = 274, // KINT
+ KDBL = 275, // KDBL
+ KSTR = 276, // KSTR
+ KLOG = 277, // KLOG
+ KBOOL = 278, // KBOOL
+ KOPT = 279, // KOPT
+ KUNIQ = 280, // KUNIQ
+ KSELF = 281, // KSELF
+ KABSTR = 282, // KABSTR
+ KSUBT = 283, // KSUBT
+ KSPRT = 284, // KSPRT
+ KANDOR = 285, // KANDOR
+ K1OF = 286, // K1OF
+ KAND = 287, // KAND
+ NUMBER = 288, // NUMBER
+ NAME = 289 // NAME
+ };
+ /// Backward compatibility alias (Bison 3.6).
+ typedef token_kind_type yytokentype;
+ };
+
+ /// Token kind, as returned by yylex.
+ typedef token::yytokentype token_kind_type;
+
+ /// Backward compatibility alias (Bison 3.6).
+ typedef token_kind_type token_type;
+
+ /// Symbol kinds.
+ struct symbol_kind
+ {
+ enum symbol_kind_type
+ {
+ YYNTOKENS = 46, ///< Number of tokens.
+ S_YYEMPTY = -2,
+ S_YYEOF = 0, // "end of file"
+ S_YYerror = 1, // error
+ S_YYUNDEF = 2, // "invalid token"
+ S_KSCHEM = 3, // KSCHEM
+ S_KENDS = 4, // KENDS
+ S_KTYP = 5, // KTYP
+ S_KENDT = 6, // KENDT
+ S_KENT = 7, // KENT
+ S_KENDE = 8, // KENDE
+ S_KREF = 9, // KREF
+ S_KFROM = 10, // KFROM
+ S_KSEL = 11, // KSEL
+ S_KENUM = 12, // KENUM
+ S_KLIST = 13, // KLIST
+ S_KARR = 14, // KARR
+ S_KBAG = 15, // KBAG
+ S_KSET = 16, // KSET
+ S_KOF = 17, // KOF
+ S_KNUM = 18, // KNUM
+ S_KINT = 19, // KINT
+ S_KDBL = 20, // KDBL
+ S_KSTR = 21, // KSTR
+ S_KLOG = 22, // KLOG
+ S_KBOOL = 23, // KBOOL
+ S_KOPT = 24, // KOPT
+ S_KUNIQ = 25, // KUNIQ
+ S_KSELF = 26, // KSELF
+ S_KABSTR = 27, // KABSTR
+ S_KSUBT = 28, // KSUBT
+ S_KSPRT = 29, // KSPRT
+ S_KANDOR = 30, // KANDOR
+ S_K1OF = 31, // K1OF
+ S_KAND = 32, // KAND
+ S_NUMBER = 33, // NUMBER
+ S_NAME = 34, // NAME
+ S_35_ = 35, // ','
+ S_36_ = 36, // ';'
+ S_37_ = 37, // '='
+ S_38_ = 38, // '('
+ S_39_ = 39, // ')'
+ S_40_ = 40, // '['
+ S_41_ = 41, // ':'
+ S_42_ = 42, // ']'
+ S_43_ = 43, // '?'
+ S_44_ = 44, // '\\'
+ S_45_ = 45, // '.'
+ S_YYACCEPT = 46, // $accept
+ S_SCHEMA = 47, // SCHEMA
+ S_ILIST = 48, // ILIST
+ S_ITEM = 49, // ITEM
+ S_ENUM = 50, // ENUM
+ S_SELECT = 51, // SELECT
+ S_ALIAS = 52, // ALIAS
+ S_ENTITY = 53, // ENTITY
+ S_REFERENCE = 54, // REFERENCE
+ S_TLIST = 55, // TLIST
+ S_TLIST1 = 56, // TLIST1
+ S_TYPE = 57, // TYPE
+ S_TSTD = 58, // TSTD
+ S_TNAME = 59, // TNAME
+ S_TSET = 60, // TSET
+ S_INDEX = 61, // INDEX
+ S_OPTUNI = 62, // OPTUNI
+ S_SUBT = 63, // SUBT
+ S_SUPERT = 64, // SUPERT
+ S_SUPLST = 65, // SUPLST
+ S_FLIST = 66, // FLIST
+ S_FLIST1 = 67, // FLIST1
+ S_FIELD = 68, // FIELD
+ S_REDEF = 69, // REDEF
+ S_SPECIF = 70, // SPECIF
+ S_OPTNL = 71, // OPTNL
+ S_UNIQIT = 72, // UNIQIT
+ S_UNIQLS = 73, // UNIQLS
+ S_UNIQUE = 74, // UNIQUE
+ S_SPCLST = 75 // SPCLST
+ };
+ };
+
+ /// (Internal) symbol kind.
+ typedef symbol_kind::symbol_kind_type symbol_kind_type;
+
+ /// The number of tokens.
+ static const symbol_kind_type YYNTOKENS = symbol_kind::YYNTOKENS;
+
+ /// A complete symbol.
+ ///
+ /// Expects its Base type to provide access to the symbol kind
+ /// via kind ().
+ ///
+ /// Provide access to semantic value.
+ template <typename Base>
+ struct basic_symbol : Base
+ {
+ /// Alias to Base.
+ typedef Base super_type;
+
+ /// Default constructor.
+ basic_symbol ()
+ : value ()
+ {}
+
+#if 201103L <= YY_CPLUSPLUS
+ /// Move constructor.
+ basic_symbol (basic_symbol&& that)
+ : Base (std::move (that))
+ , value (std::move (that.value))
+ {}
+#endif
+
+ /// Copy constructor.
+ basic_symbol (const basic_symbol& that);
+ /// Constructor for valueless symbols.
+ basic_symbol (typename Base::kind_type t);
+
+ /// Constructor for symbols with semantic value.
+ basic_symbol (typename Base::kind_type t,
+ YY_RVREF (semantic_type) v);
+
+ /// Destroy the symbol.
+ ~basic_symbol ()
+ {
+ clear ();
+ }
+
+ /// Destroy contents, and record that is empty.
+ void clear ()
+ {
+ Base::clear ();
+ }
+
+#if YYDEBUG || 0
+ /// The user-facing name of this symbol.
+ const char *name () const YY_NOEXCEPT
+ {
+ return parser::symbol_name (this->kind ());
+ }
+#endif // #if YYDEBUG || 0
+
+
+ /// Backward compatibility (Bison 3.6).
+ symbol_kind_type type_get () const YY_NOEXCEPT;
+
+ /// Whether empty.
+ bool empty () const YY_NOEXCEPT;
+
+ /// Destructive move, \a s is emptied into this.
+ void move (basic_symbol& s);
+
+ /// The semantic value.
+ semantic_type value;
+
+ private:
+#if YY_CPLUSPLUS < 201103L
+ /// Assignment operator.
+ basic_symbol& operator= (const basic_symbol& that);
+#endif
+ };
+
+ /// Type access provider for token (enum) based symbols.
+ struct by_kind
+ {
+ /// Default constructor.
+ by_kind ();
+
+#if 201103L <= YY_CPLUSPLUS
+ /// Move constructor.
+ by_kind (by_kind&& that);
+#endif
+
+ /// Copy constructor.
+ by_kind (const by_kind& that);
+
+ /// The symbol kind as needed by the constructor.
+ typedef token_kind_type kind_type;
+
+ /// Constructor from (external) token numbers.
+ by_kind (kind_type t);
+
+ /// Record that this symbol is empty.
+ void clear ();
+
+ /// Steal the symbol kind from \a that.
+ void move (by_kind& that);
+
+ /// The (internal) type number (corresponding to \a type).
+ /// \a empty when empty.
+ symbol_kind_type kind () const YY_NOEXCEPT;
+
+ /// Backward compatibility (Bison 3.6).
+ symbol_kind_type type_get () const YY_NOEXCEPT;
+
+ /// The symbol kind.
+ /// \a S_YYEMPTY when empty.
+ symbol_kind_type kind_;
+ };
+
+ /// Backward compatibility for a private implementation detail (Bison 3.6).
+ typedef by_kind by_type;
+
+ /// "External" symbols: returned by the scanner.
+ struct symbol_type : basic_symbol<by_kind>
+ {};
+
+ /// Build a parser object.
+ parser (exptocas::scanner* scanner_yyarg);
+ virtual ~parser ();
+
+#if 201103L <= YY_CPLUSPLUS
+ /// Non copyable.
+ parser (const parser&) = delete;
+ /// Non copyable.
+ parser& operator= (const parser&) = delete;
+#endif
+
+ /// Parse. An alias for parse ().
+ /// \returns 0 iff parsing succeeded.
+ int operator() ();
+
+ /// Parse.
+ /// \returns 0 iff parsing succeeded.
+ virtual int parse ();
+
+#if YYDEBUG
+ /// The current debugging stream.
+ std::ostream& debug_stream () const YY_ATTRIBUTE_PURE;
+ /// Set the current debugging stream.
+ void set_debug_stream (std::ostream &);
+
+ /// Type for debugging levels.
+ typedef int debug_level_type;
+ /// The current debugging level.
+ debug_level_type debug_level () const YY_ATTRIBUTE_PURE;
+ /// Set the current debugging level.
+ void set_debug_level (debug_level_type l);
+#endif
+
+ /// Report a syntax error.
+ /// \param msg a description of the syntax error.
+ virtual void error (const std::string& msg);
+
+ /// Report a syntax error.
+ void error (const syntax_error& err);
+
+#if YYDEBUG || 0
+ /// The user-facing name of the symbol whose (internal) number is
+ /// YYSYMBOL. No bounds checking.
+ static const char *symbol_name (symbol_kind_type yysymbol);
+#endif // #if YYDEBUG || 0
+
+
+
+
+ private:
+#if YY_CPLUSPLUS < 201103L
+ /// Non copyable.
+ parser (const parser&);
+ /// Non copyable.
+ parser& operator= (const parser&);
+#endif
+
+
+ /// Stored state numbers (used for stacks).
+ typedef unsigned char state_type;
+
+ /// Compute post-reduction state.
+ /// \param yystate the current state
+ /// \param yysym the nonterminal to push on the stack
+ static state_type yy_lr_goto_state_ (state_type yystate, int yysym);
+
+ /// Whether the given \c yypact_ value indicates a defaulted state.
+ /// \param yyvalue the value to check
+ static bool yy_pact_value_is_default_ (int yyvalue);
+
+ /// Whether the given \c yytable_ value indicates a syntax error.
+ /// \param yyvalue the value to check
+ static bool yy_table_value_is_error_ (int yyvalue);
+
+ static const short yypact_ninf_;
+ static const signed char yytable_ninf_;
+
+ /// Convert a scanner token kind \a t to a symbol kind.
+ /// In theory \a t should be a token_kind_type, but character literals
+ /// are valid, yet not members of the token_type enum.
+ static symbol_kind_type yytranslate_ (int t);
+
+#if YYDEBUG || 0
+ /// For a symbol, its name in clear.
+ static const char* const yytname_[];
+#endif // #if YYDEBUG || 0
+
+
+ // Tables.
+ // YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
+ // STATE-NUM.
+ static const short yypact_[];
+
+ // YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
+ // Performed when YYTABLE does not specify something else to do. Zero
+ // means the default is an error.
+ static const signed char yydefact_[];
+
+ // YYPGOTO[NTERM-NUM].
+ static const short yypgoto_[];
+
+ // YYDEFGOTO[NTERM-NUM].
+ static const short yydefgoto_[];
+
+ // YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
+ // positive, shift that token. If negative, reduce the rule whose
+ // number is the opposite. If YYTABLE_NINF, syntax error.
+ static const unsigned char yytable_[];
+
+ static const short yycheck_[];
+
+ // YYSTOS[STATE-NUM] -- The (internal number of the) accessing
+ // symbol of state STATE-NUM.
+ static const signed char yystos_[];
+
+ // YYR1[YYN] -- Symbol number of symbol that rule YYN derives.
+ static const signed char yyr1_[];
+
+ // YYR2[YYN] -- Number of symbols on the right hand side of rule YYN.
+ static const signed char yyr2_[];
+
+
+#if YYDEBUG
+ // YYRLINE[YYN] -- Source line where rule number YYN was defined.
+ static const short yyrline_[];
+ /// Report on the debug stream that the rule \a r is going to be reduced.
+ virtual void yy_reduce_print_ (int r) const;
+ /// Print the state stack on the debug stream.
+ virtual void yy_stack_print_ () const;
+
+ /// Debugging level.
+ int yydebug_;
+ /// Debug stream.
+ std::ostream* yycdebug_;
+
+ /// \brief Display a symbol kind, value and location.
+ /// \param yyo The output stream.
+ /// \param yysym The symbol.
+ template <typename Base>
+ void yy_print_ (std::ostream& yyo, const basic_symbol<Base>& yysym) const;
+#endif
+
+ /// \brief Reclaim the memory associated to a symbol.
+ /// \param yymsg Why this token is reclaimed.
+ /// If null, print nothing.
+ /// \param yysym The symbol.
+ template <typename Base>
+ void yy_destroy_ (const char* yymsg, basic_symbol<Base>& yysym) const;
+
+ private:
+ /// Type access provider for state based symbols.
+ struct by_state
+ {
+ /// Default constructor.
+ by_state () YY_NOEXCEPT;
+
+ /// The symbol kind as needed by the constructor.
+ typedef state_type kind_type;
+
+ /// Constructor.
+ by_state (kind_type s) YY_NOEXCEPT;
+
+ /// Copy constructor.
+ by_state (const by_state& that) YY_NOEXCEPT;
+
+ /// Record that this symbol is empty.
+ void clear () YY_NOEXCEPT;
+
+ /// Steal the symbol kind from \a that.
+ void move (by_state& that);
+
+ /// The symbol kind (corresponding to \a state).
+ /// \a symbol_kind::S_YYEMPTY when empty.
+ symbol_kind_type kind () const YY_NOEXCEPT;
+
+ /// The state number used to denote an empty symbol.
+ /// We use the initial state, as it does not have a value.
+ enum { empty_state = 0 };
+
+ /// The state.
+ /// \a empty when empty.
+ state_type state;
+ };
+
+ /// "Internal" symbol: element of the stack.
+ struct stack_symbol_type : basic_symbol<by_state>
+ {
+ /// Superclass.
+ typedef basic_symbol<by_state> super_type;
+ /// Construct an empty symbol.
+ stack_symbol_type ();
+ /// Move or copy construction.
+ stack_symbol_type (YY_RVREF (stack_symbol_type) that);
+ /// Steal the contents from \a sym to build this.
+ stack_symbol_type (state_type s, YY_MOVE_REF (symbol_type) sym);
+#if YY_CPLUSPLUS < 201103L
+ /// Assignment, needed by push_back by some old implementations.
+ /// Moves the contents of that.
+ stack_symbol_type& operator= (stack_symbol_type& that);
+
+ /// Assignment, needed by push_back by other implementations.
+ /// Needed by some other old implementations.
+ stack_symbol_type& operator= (const stack_symbol_type& that);
+#endif
+ };
+
+ /// A stack with random access from its top.
+ template <typename T, typename S = std::vector<T> >
+ class stack
+ {
+ public:
+ // Hide our reversed order.
+ typedef typename S::iterator iterator;
+ typedef typename S::const_iterator const_iterator;
+ typedef typename S::size_type size_type;
+ typedef typename std::ptrdiff_t index_type;
+
+ stack (size_type n = 200)
+ : seq_ (n)
+ {}
+
+#if 201103L <= YY_CPLUSPLUS
+ /// Non copyable.
+ stack (const stack&) = delete;
+ /// Non copyable.
+ stack& operator= (const stack&) = delete;
+#endif
+
+ /// Random access.
+ ///
+ /// Index 0 returns the topmost element.
+ const T&
+ operator[] (index_type i) const
+ {
+ return seq_[size_type (size () - 1 - i)];
+ }
+
+ /// Random access.
+ ///
+ /// Index 0 returns the topmost element.
+ T&
+ operator[] (index_type i)
+ {
+ return seq_[size_type (size () - 1 - i)];
+ }
+
+ /// Steal the contents of \a t.
+ ///
+ /// Close to move-semantics.
+ void
+ push (YY_MOVE_REF (T) t)
+ {
+ seq_.push_back (T ());
+ operator[] (0).move (t);
+ }
+
+ /// Pop elements from the stack.
+ void
+ pop (std::ptrdiff_t n = 1) YY_NOEXCEPT
+ {
+ for (; 0 < n; --n)
+ seq_.pop_back ();
+ }
+
+ /// Pop all elements from the stack.
+ void
+ clear () YY_NOEXCEPT
+ {
+ seq_.clear ();
+ }
+
+ /// Number of elements on the stack.
+ index_type
+ size () const YY_NOEXCEPT
+ {
+ return index_type (seq_.size ());
+ }
+
+ /// Iterator on top of the stack (going downwards).
+ const_iterator
+ begin () const YY_NOEXCEPT
+ {
+ return seq_.begin ();
+ }
+
+ /// Bottom of the stack.
+ const_iterator
+ end () const YY_NOEXCEPT
+ {
+ return seq_.end ();
+ }
+
+ /// Present a slice of the top of a stack.
+ class slice
+ {
+ public:
+ slice (const stack& stack, index_type range)
+ : stack_ (stack)
+ , range_ (range)
+ {}
+
+ const T&
+ operator[] (index_type i) const
+ {
+ return stack_[range_ - i];
+ }
+
+ private:
+ const stack& stack_;
+ index_type range_;
+ };
+
+ private:
+#if YY_CPLUSPLUS < 201103L
+ /// Non copyable.
+ stack (const stack&);
+ /// Non copyable.
+ stack& operator= (const stack&);
+#endif
+ /// The wrapped container.
+ S seq_;
+ };
+
+
+ /// Stack type.
+ typedef stack<stack_symbol_type> stack_type;
+
+ /// The stack.
+ stack_type yystack_;
+
+ /// Push a new state on the stack.
+ /// \param m a debug message to display
+ /// if null, no trace is output.
+ /// \param sym the symbol
+ /// \warning the contents of \a s.value is stolen.
+ void yypush_ (const char* m, YY_MOVE_REF (stack_symbol_type) sym);
+
+ /// Push a new look ahead token on the state on the stack.
+ /// \param m a debug message to display
+ /// if null, no trace is output.
+ /// \param s the state
+ /// \param sym the symbol (for its value and location).
+ /// \warning the contents of \a sym.value is stolen.
+ void yypush_ (const char* m, state_type s, YY_MOVE_REF (symbol_type) sym);
+
+ /// Pop \a n symbols from the stack.
+ void yypop_ (int n = 1);
+
+ /// Constants.
+ enum
+ {
+ yylast_ = 164, ///< Last index in yytable_.
+ yynnts_ = 30, ///< Number of nonterminal symbols.
+ yyfinal_ = 4 ///< Termination state number.
+ };
+
+
+ // User arguments.
+ exptocas::scanner* scanner;
+
+ };
+
+
+} // exptocas
+
+
+// "%code provides" blocks.
+
+#if !defined(yyFlexLexer) && !defined(FlexLexerOnce)
+#define yyFlexLexer exptocasFlexLexer
+#include "FlexLexer.h"
+#endif
+namespace exptocas {
+ // To feed data back to bison, the yylex method needs yylval and
+ // yylloc parameters. Since the exptocasFlexLexer class is defined in the
+ // system header <FlexLexer.h> the signature of its yylex() method
+ // can not be changed anymore. This makes it necessary to derive a
+ // scanner class that provides a method with the desired signature:
+ class scanner : public exptocasFlexLexer
+ {
+ public:
+ explicit scanner(std::istream* in = 0, std::ostream* out = 0);
+
+ int lex(exptocas::parser::semantic_type* yylval);
+ };
+};
+
+
+
+#endif // !YY_EXPTOCAS_EXPTOCASEXE_EXPTOCAS_TAB_HXX_INCLUDED
--- /dev/null
+%{
+
+// Created: Thu Oct 28 12:21:16 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.
+
+/*****************************************************************************
+
+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 <OSD_OpenFile.hxx>
+#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 exptocas.l) */
+int ec_error ( const std::string& s, const std::string& 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 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 );
+
+%}
+
+%language "C++"
+%debug
+%require "3.2"
+
+%parse-param {exptocas::scanner* scanner}
+
+%code requires {
+namespace exptocas {
+ class scanner;
+};
+#ifdef _MSC_VER
+// disable MSVC warning C4522: 'exptocas::parser::stack_symbol_type': multiple assignment operators
+#pragma warning(disable: 4522)
+#endif
+}
+
+%code provides {
+#if !defined(yyFlexLexer) && !defined(FlexLexerOnce)
+#define yyFlexLexer exptocasFlexLexer
+#include "FlexLexer.h"
+#endif
+namespace exptocas {
+ // To feed data back to bison, the yylex method needs yylval and
+ // yylloc parameters. Since the exptocasFlexLexer class is defined in the
+ // system header <FlexLexer.h> the signature of its yylex() method
+ // can not be changed anymore. This makes it necessary to derive a
+ // scanner class that provides a method with the desired signature:
+ class scanner : public exptocasFlexLexer
+ {
+ public:
+ explicit scanner(std::istream* in = 0, std::ostream* out = 0);
+
+ int lex(exptocas::parser::semantic_type* yylval);
+ };
+};
+}
+
+%code {
+#undef yylex
+#define yylex scanner->lex
+// disable MSVC warnings in bison code
+#ifdef _MSC_VER
+#pragma warning(disable:4244 4800)
+#endif
+}
+
+/* Definition of possible types of expressions */
+%union {
+ 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;
+}
+
+/* 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
+ | REFERENCE
+ | 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 { $$ = $2; /* ignore redefinition of inherited field, take trailing list */ }
+ ;
+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 ';' { $$ = 0; 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 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 exptocas::parser::token::KINT : return new Express_Integer;
+ case exptocas::parser::token::KNUM : return new Express_Number;
+ case exptocas::parser::token::KDBL : return new Express_Real;
+ case exptocas::parser::token::KSTR : return new Express_String;
+ case exptocas::parser::token::KBOOL: return new Express_Boolean;
+ case exptocas::parser::token::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 exptocas::parser::token::KLIST: return new Express_List ( ilow, ihigh, of );
+ case exptocas::parser::token::KARR : return new Express_Array ( ilow, ihigh, of );
+ case exptocas::parser::token::KBAG : return new Express_Bag ( ilow, ihigh, of );
+ case exptocas::parser::token::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(const char* theFileName)
+{
+ std::ifstream aFileStream;
+ OSD_OpenStream(aFileStream, theFileName, std::ios_base::in | std::ios_base::binary);
+ exptocas::scanner aScanner(&aFileStream);
+ aScanner.yyrestart(aFileStream);
+ // uncomment next string for debug of parser
+ //aScanner.set_debug(1);
+ exptocas::parser aParser(&aScanner);
+ aParser.parse();
+ 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;
+}
+*/
+
+void exptocas::parser::error(const std::string& s)
+{
+ printf("\nParse error at line %d: %s\n", scanner->lineno(), s.c_str());
+}
+
--- /dev/null
+#line 89 "D:/GIT3/occt/src/ExpToCasExe/exptocas.lex"
+// Pre-include stdlib.h to avoid redefinition of integer type macros (INT8_MIN and similar in generated code)
+#if !defined(_MSC_VER) || (_MSC_VER >= 1600) // Visual Studio 2010+
+#include "stdint.h"
+#endif
+
+
+
+#define YY_INT_ALIGNED short int
+
+/* A lexical scanner generated by flex */
+
+
+
+
+
+
+
+
+/* %not-for-header */
+/* %if-c-only */
+/* %if-not-reentrant */
+/* %endif */
+/* %endif */
+/* %ok-for-header */
+
+
+#define FLEX_SCANNER
+#define YY_FLEX_MAJOR_VERSION 2
+#define YY_FLEX_MINOR_VERSION 6
+#define YY_FLEX_SUBMINOR_VERSION 4
+#if YY_FLEX_SUBMINOR_VERSION > 0
+#define FLEX_BETA
+#endif
+
+
+
+
+
+
+
+
+
+
+
+
+
+/* %if-c++-only */
+ /* The c++ scanner is a mess. The FlexLexer.h header file relies on the
+ * following macro. This is required in order to pass the c++-multiple-scanners
+ * test in the regression suite. We get reports that it breaks inheritance.
+ * We will address this in a future release of flex, or omit the C++ scanner
+ * altogether.
+ */
+ #define yyFlexLexer exptocasFlexLexer
+/* %endif */
+
+/* %if-c-only */
+/* %endif */
+
+
+
+
+
+
+#ifdef yyalloc
+#define exptocasalloc_ALREADY_DEFINED
+#else
+#define yyalloc exptocasalloc
+#endif
+
+
+#ifdef yyrealloc
+#define exptocasrealloc_ALREADY_DEFINED
+#else
+#define yyrealloc exptocasrealloc
+#endif
+
+
+#ifdef yyfree
+#define exptocasfree_ALREADY_DEFINED
+#else
+#define yyfree exptocasfree
+#endif
+
+
+
+/* %if-c-only */
+/* %endif */
+
+
+
+
+/* First, we deal with platform-specific or compiler-specific issues. */
+
+/* begin standard C headers. */
+/* %if-c-only */
+/* %endif */
+
+/* %if-tables-serialization */
+/* %endif */
+/* end standard C headers. */
+
+/* %if-c-or-c++ */
+/* flex integer type definitions */
+
+#ifndef FLEXINT_H
+#define FLEXINT_H
+
+/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
+
+#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
+
+/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
+ * if you want the limit (max/min) macros for int types.
+ */
+#ifndef __STDC_LIMIT_MACROS
+#define __STDC_LIMIT_MACROS 1
+#endif
+
+#include <inttypes.h>
+typedef int8_t flex_int8_t;
+typedef uint8_t flex_uint8_t;
+typedef int16_t flex_int16_t;
+typedef uint16_t flex_uint16_t;
+typedef int32_t flex_int32_t;
+typedef uint32_t flex_uint32_t;
+#else
+typedef signed char flex_int8_t;
+typedef short int flex_int16_t;
+typedef int flex_int32_t;
+typedef unsigned char flex_uint8_t;
+typedef unsigned short int flex_uint16_t;
+typedef unsigned int flex_uint32_t;
+
+/* Limits of integral types. */
+#ifndef INT8_MIN
+#define INT8_MIN (-128)
+#endif
+#ifndef INT16_MIN
+#define INT16_MIN (-32767-1)
+#endif
+#ifndef INT32_MIN
+#define INT32_MIN (-2147483647-1)
+#endif
+#ifndef INT8_MAX
+#define INT8_MAX (127)
+#endif
+#ifndef INT16_MAX
+#define INT16_MAX (32767)
+#endif
+#ifndef INT32_MAX
+#define INT32_MAX (2147483647)
+#endif
+#ifndef UINT8_MAX
+#define UINT8_MAX (255U)
+#endif
+#ifndef UINT16_MAX
+#define UINT16_MAX (65535U)
+#endif
+#ifndef UINT32_MAX
+#define UINT32_MAX (4294967295U)
+#endif
+
+#ifndef SIZE_MAX
+#define SIZE_MAX (~(size_t)0)
+#endif
+
+#endif /* ! C99 */
+
+#endif /* ! FLEXINT_H */
+
+/* %endif */
+
+/* begin standard C++ headers. */
+/* %if-c++-only */
+#include <iostream>
+#include <errno.h>
+#include <cstdlib>
+#include <cstdio>
+#include <cstring>
+/* end standard C++ headers. */
+/* %endif */
+
+/* TODO: this is always defined, so inline it */
+#define yyconst const
+
+#if defined(__GNUC__) && __GNUC__ >= 3
+#define yynoreturn __attribute__((__noreturn__))
+#else
+#define yynoreturn
+#endif
+
+/* %not-for-header */
+/* Returned upon end-of-file. */
+#define YY_NULL 0
+/* %ok-for-header */
+
+
+/* %not-for-header */
+/* Promotes a possibly negative, possibly signed char to an
+ * integer in range [0..255] for use as an array index.
+ */
+#define YY_SC_TO_UI(c) ((YY_CHAR) (c))
+/* %ok-for-header */
+
+
+
+
+/* %if-reentrant */
+/* %endif */
+
+
+
+/* %if-not-reentrant */
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+/* %endif */
+
+
+
+
+
+
+
+/* Enter a start condition. This macro really ought to take a parameter,
+ * but we do it the disgusting crufty way forced on us by the ()-less
+ * definition of BEGIN.
+ */
+#define BEGIN (yy_start) = 1 + 2 *
+/* Translate the current start state into a value that can be later handed
+ * to BEGIN to return to the state. The YYSTATE alias is for lex
+ * compatibility.
+ */
+#define YY_START (((yy_start) - 1) / 2)
+#define YYSTATE YY_START
+/* Action number for EOF rule of a given start state. */
+#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
+/* Special action meaning "start processing a new file". */
+#define YY_NEW_FILE yyrestart( yyin )
+#define YY_END_OF_BUFFER_CHAR 0
+
+
+/* Size of default input buffer. */
+#ifndef YY_BUF_SIZE
+#ifdef __ia64__
+/* On IA-64, the buffer size is 16k, not 8k.
+ * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case.
+ * Ditto for the __ia64__ case accordingly.
+ */
+#define YY_BUF_SIZE 32768
+#else
+#define YY_BUF_SIZE 16384
+#endif /* __ia64__ */
+#endif
+
+
+/* The state buf must be large enough to hold one state per character in the main buffer.
+ */
+#define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
+
+
+
+#ifndef YY_TYPEDEF_YY_BUFFER_STATE
+#define YY_TYPEDEF_YY_BUFFER_STATE
+typedef struct yy_buffer_state *YY_BUFFER_STATE;
+#endif
+
+#ifndef YY_TYPEDEF_YY_SIZE_T
+#define YY_TYPEDEF_YY_SIZE_T
+typedef size_t yy_size_t;
+#endif
+
+/* %if-not-reentrant */
+extern int yyleng;
+/* %endif */
+
+/* %if-c-only */
+/* %if-not-reentrant */
+/* %endif */
+/* %endif */
+
+
+#define EOB_ACT_CONTINUE_SCAN 0
+#define EOB_ACT_END_OF_FILE 1
+#define EOB_ACT_LAST_MATCH 2
+
+ #define YY_LESS_LINENO(n)
+ #define YY_LINENO_REWIND_TO(ptr)
+
+/* Return all but the first "n" matched characters back to the input stream. */
+#define yyless(n) \
+ do \
+ { \
+ /* Undo effects of setting up yytext. */ \
+ int yyless_macro_arg = (n); \
+ YY_LESS_LINENO(yyless_macro_arg);\
+ *yy_cp = (yy_hold_char); \
+ YY_RESTORE_YY_MORE_OFFSET \
+ (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
+ YY_DO_BEFORE_ACTION; /* set up yytext again */ \
+ } \
+ while ( 0 )
+#define unput(c) yyunput( c, (yytext_ptr) )
+
+
+#ifndef YY_STRUCT_YY_BUFFER_STATE
+#define YY_STRUCT_YY_BUFFER_STATE
+struct yy_buffer_state
+ {
+/* %if-c-only */
+/* %endif */
+
+/* %if-c++-only */
+ std::streambuf* yy_input_file;
+/* %endif */
+
+
+ char *yy_ch_buf; /* input buffer */
+ char *yy_buf_pos; /* current position in input buffer */
+
+ /* Size of input buffer in bytes, not including room for EOB
+ * characters.
+ */
+ int yy_buf_size;
+
+ /* Number of characters read into yy_ch_buf, not including EOB
+ * characters.
+ */
+ int yy_n_chars;
+
+ /* Whether we "own" the buffer - i.e., we know we created it,
+ * and can realloc() it to grow it, and should free() it to
+ * delete it.
+ */
+ int yy_is_our_buffer;
+
+ /* Whether this is an "interactive" input source; if so, and
+ * if we're using stdio for input, then we want to use getc()
+ * instead of fread(), to make sure we stop fetching input after
+ * each newline.
+ */
+ int yy_is_interactive;
+
+ /* Whether we're considered to be at the beginning of a line.
+ * If so, '^' rules will be active on the next match, otherwise
+ * not.
+ */
+ int yy_at_bol;
+
+ int yy_bs_lineno; /**< The line count. */
+ int yy_bs_column; /**< The column count. */
+
+
+ /* Whether to try to fill the input buffer when we reach the
+ * end of it.
+ */
+ int yy_fill_buffer;
+
+ int yy_buffer_status;
+
+#define YY_BUFFER_NEW 0
+#define YY_BUFFER_NORMAL 1
+ /* When an EOF's been seen but there's still some text to process
+ * then we mark the buffer as YY_EOF_PENDING, to indicate that we
+ * shouldn't try reading from the input source any more. We might
+ * still have a bunch of tokens to match, though, because of
+ * possible backing-up.
+ *
+ * When we actually see the EOF, we change the status to "new"
+ * (via yyrestart()), so that the user can continue scanning by
+ * just pointing yyin at a new input file.
+ */
+#define YY_BUFFER_EOF_PENDING 2
+
+ };
+#endif /* !YY_STRUCT_YY_BUFFER_STATE */
+
+/* %if-c-only Standard (non-C++) definition */
+/* %not-for-header */
+/* %if-not-reentrant */
+/* %endif */
+/* %ok-for-header */
+
+/* %endif */
+
+
+/* We provide macros for accessing buffer states in case in the
+ * future we want to put the buffer states in a more general
+ * "scanner state".
+ *
+ * Returns the top of the stack, or NULL.
+ */
+#define YY_CURRENT_BUFFER ( (yy_buffer_stack) \
+ ? (yy_buffer_stack)[(yy_buffer_stack_top)] \
+ : NULL)
+/* Same as previous macro, but useful when we know that the buffer stack is not
+ * NULL or when we need an lvalue. For internal use only.
+ */
+#define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)]
+
+
+/* %if-c-only Standard (non-C++) definition */
+/* %if-not-reentrant */
+/* %not-for-header */
+/* %ok-for-header */
+
+/* %endif */
+/* %endif */
+
+void *yyalloc ( yy_size_t );
+void *yyrealloc ( void *, yy_size_t );
+void yyfree ( void * );
+
+
+#define yy_new_buffer yy_create_buffer
+#define yy_set_interactive(is_interactive) \
+ { \
+ if ( ! YY_CURRENT_BUFFER ){ \
+ yyensure_buffer_stack (); \
+ YY_CURRENT_BUFFER_LVALUE = \
+ yy_create_buffer( yyin, YY_BUF_SIZE ); \
+ } \
+ YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
+ }
+#define yy_set_bol(at_bol) \
+ { \
+ if ( ! YY_CURRENT_BUFFER ){\
+ yyensure_buffer_stack (); \
+ YY_CURRENT_BUFFER_LVALUE = \
+ yy_create_buffer( yyin, YY_BUF_SIZE ); \
+ } \
+ YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
+ }
+#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
+
+
+/* %% [1.0] yytext/yyin/yyout/yy_state_type/yylineno etc. def's & init go here */
+/* Begin user sect3 */
+#define YY_SKIP_YYWRAP
+
+#define FLEX_DEBUG
+typedef flex_uint8_t YY_CHAR;
+
+#define yytext_ptr yytext
+#define YY_INTERACTIVE
+
+
+#include <FlexLexer.h>
+
+int yyFlexLexer::yywrap() { return 1; }
+int yyFlexLexer::yylex()
+ {
+ LexerError( "yyFlexLexer::yylex invoked but %option yyclass used" );
+ return 0;
+ }
+
+#define YY_DECL int exptocas::scanner::yylex()
+
+
+/* %% [1.5] DFA */
+
+
+/* %if-c-only Standard (non-C++) definition */
+/* %endif */
+
+
+/* Done after the current pattern has been matched and before the
+ * corresponding action - sets up yytext.
+ */
+#define YY_DO_BEFORE_ACTION \
+ (yytext_ptr) = yy_bp; \
+/* %% [2.0] code to fiddle yytext and yyleng for yymore() goes here \ */\
+ yyleng = (int) (yy_cp - yy_bp); \
+ (yy_hold_char) = *yy_cp; \
+ *yy_cp = '\0'; \
+/* %% [3.0] code to copy yytext_ptr to yytext[] goes here, if %array \ */\
+ (yy_c_buf_p) = yy_cp;
+/* %% [4.0] data tables for the DFA and the user's section 1 definitions go here */
+#define YY_NUM_RULES 56
+#define YY_END_OF_BUFFER 57
+/* This struct is not used in this scanner,
+ but its presence is necessary. */
+struct yy_trans_info
+ {
+ flex_int32_t yy_verify;
+ flex_int32_t yy_nxt;
+ };
+static const flex_int16_t yy_accept[306] =
+ { 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 44, 44, 57, 54, 52, 55, 40, 40,
+ 54, 39, 53, 53, 53, 53, 53, 53, 53, 53,
+ 53, 53, 53, 53, 53, 53, 38, 53, 53, 53,
+ 53, 53, 3, 3, 14, 14, 49, 49, 46, 46,
+ 46, 46, 44, 44, 44, 52, 2, 1, 39, 53,
+ 53, 53, 53, 53, 53, 53, 53, 53, 53, 53,
+ 53, 53, 21, 53, 53, 53, 53, 53, 53, 53,
+ 53, 53, 53, 53, 38, 53, 53, 53, 53, 53,
+ 4, 0, 0, 0, 45, 42, 43, 44, 44, 44,
+
+ 1, 53, 36, 53, 20, 53, 53, 53, 53, 53,
+ 53, 53, 53, 53, 53, 53, 53, 53, 53, 53,
+ 53, 19, 53, 53, 53, 53, 53, 37, 53, 53,
+ 53, 53, 53, 0, 0, 43, 44, 44, 53, 53,
+ 53, 53, 53, 53, 53, 53, 53, 53, 17, 53,
+ 53, 53, 53, 24, 48, 53, 53, 30, 53, 53,
+ 53, 7, 53, 53, 53, 53, 53, 53, 0, 0,
+ 44, 44, 53, 34, 18, 53, 53, 53, 53, 53,
+ 53, 53, 53, 53, 35, 53, 53, 53, 53, 53,
+ 53, 53, 53, 13, 53, 53, 53, 0, 0, 0,
+
+ 44, 44, 53, 53, 53, 53, 9, 53, 53, 53,
+ 53, 22, 53, 5, 15, 25, 53, 53, 29, 53,
+ 12, 53, 53, 0, 0, 0, 44, 44, 53, 27,
+ 53, 53, 53, 53, 23, 26, 53, 32, 53, 53,
+ 53, 11, 0, 0, 0, 44, 44, 31, 53, 53,
+ 53, 41, 28, 53, 8, 53, 0, 8, 0, 44,
+ 41, 0, 53, 53, 53, 33, 53, 0, 50, 44,
+ 0, 53, 6, 53, 10, 10, 44, 0, 53, 16,
+ 44, 0, 53, 44, 0, 53, 47, 0, 53, 0,
+ 53, 0, 53, 0, 53, 0, 53, 0, 53, 0,
+
+ 53, 0, 53, 51, 0
+ } ;
+
+static const YY_CHAR yy_ec[256] =
+ { 0,
+ 1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 2, 1, 1, 1, 1, 1, 1, 4, 5,
+ 6, 7, 1, 8, 9, 8, 1, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 11, 12, 1,
+ 11, 1, 8, 1, 13, 14, 15, 16, 17, 18,
+ 19, 20, 21, 22, 22, 23, 24, 25, 26, 27,
+ 28, 29, 30, 31, 32, 33, 34, 22, 35, 22,
+ 36, 8, 37, 1, 38, 1, 39, 39, 39, 39,
+
+ 39, 39, 39, 39, 39, 39, 39, 39, 39, 39,
+ 39, 39, 39, 39, 39, 39, 39, 39, 39, 39,
+ 39, 39, 1, 40, 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
+ } ;
+
+static const YY_CHAR yy_meta[41] =
+ { 0,
+ 1, 2, 3, 2, 2, 2, 1, 1, 2, 4,
+ 2, 2, 5, 5, 5, 5, 4, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 1, 1, 4, 4, 2
+ } ;
+
+static const flex_int16_t yy_base[316] =
+ { 0,
+ 0, 0, 24, 26, 29, 35, 52, 54, 45, 51,
+ 61, 62, 79, 119, 412, 413, 409, 413, 403, 413,
+ 400, 398, 75, 79, 381, 0, 381, 373, 379, 45,
+ 371, 49, 76, 86, 367, 48, 60, 376, 380, 382,
+ 373, 372, 413, 390, 413, 370, 413, 369, 413, 389,
+ 385, 382, 0, 365, 357, 386, 413, 0, 377, 0,
+ 356, 369, 355, 364, 356, 356, 78, 355, 348, 348,
+ 358, 352, 0, 358, 343, 360, 349, 351, 83, 341,
+ 115, 342, 347, 357, 101, 116, 349, 336, 118, 102,
+ 413, 348, 347, 358, 413, 413, 0, 0, 345, 335,
+
+ 0, 328, 332, 344, 0, 333, 325, 316, 332, 328,
+ 336, 333, 318, 327, 333, 320, 324, 321, 326, 325,
+ 95, 0, 320, 309, 322, 321, 309, 326, 297, 305,
+ 312, 294, 314, 292, 291, 0, 290, 312, 297, 296,
+ 289, 306, 291, 291, 289, 302, 287, 298, 0, 301,
+ 298, 296, 287, 0, 0, 288, 296, 0, 285, 274,
+ 279, 0, 275, 113, 289, 272, 121, 275, 129, 274,
+ 284, 270, 287, 0, 0, 286, 285, 282, 261, 266,
+ 273, 276, 279, 262, 0, 265, 276, 257, 268, 259,
+ 254, 267, 248, 0, 265, 256, 250, 254, 243, 245,
+
+ 244, 254, 259, 248, 247, 251, 0, 257, 243, 239,
+ 244, 0, 253, 0, 0, 0, 248, 229, 0, 236,
+ 0, 231, 244, 229, 232, 235, 232, 230, 224, 0,
+ 223, 236, 221, 226, 0, 0, 227, 0, 222, 231,
+ 226, 0, 225, 228, 227, 228, 217, 0, 159, 212,
+ 210, 0, 0, 179, 0, 164, 163, 413, 181, 161,
+ 0, 174, 173, 176, 162, 0, 152, 151, 413, 164,
+ 159, 158, 0, 157, 0, 413, 155, 164, 163, 0,
+ 153, 139, 138, 163, 159, 158, 413, 146, 141, 141,
+ 133, 127, 124, 122, 121, 132, 128, 82, 77, 64,
+
+ 44, 60, 37, 413, 413, 199, 204, 209, 214, 216,
+ 221, 223, 228, 233, 237
+ } ;
+
+static const flex_int16_t yy_def[316] =
+ { 0,
+ 305, 1, 1, 1, 1, 1, 306, 306, 307, 307,
+ 308, 308, 309, 309, 305, 305, 305, 305, 305, 305,
+ 305, 310, 310, 310, 310, 310, 310, 310, 310, 310,
+ 310, 310, 310, 310, 310, 310, 310, 310, 310, 310,
+ 310, 310, 305, 305, 305, 305, 305, 305, 305, 311,
+ 305, 305, 312, 312, 312, 305, 305, 313, 310, 310,
+ 310, 310, 310, 310, 310, 310, 310, 310, 310, 310,
+ 310, 310, 310, 310, 310, 310, 310, 310, 310, 310,
+ 310, 310, 310, 310, 310, 310, 310, 310, 310, 310,
+ 305, 305, 305, 311, 305, 305, 314, 312, 312, 312,
+
+ 313, 310, 310, 310, 310, 310, 310, 310, 310, 310,
+ 310, 310, 310, 310, 310, 310, 310, 310, 310, 310,
+ 310, 310, 310, 310, 310, 310, 310, 310, 310, 310,
+ 310, 310, 310, 305, 305, 314, 312, 312, 310, 310,
+ 310, 310, 310, 310, 310, 310, 310, 310, 310, 310,
+ 310, 310, 310, 310, 310, 310, 310, 310, 310, 310,
+ 310, 310, 310, 310, 310, 310, 310, 310, 305, 305,
+ 312, 312, 310, 310, 310, 310, 310, 310, 310, 310,
+ 310, 310, 310, 310, 310, 310, 310, 310, 310, 310,
+ 310, 310, 310, 310, 310, 310, 310, 305, 305, 305,
+
+ 312, 312, 310, 310, 310, 310, 310, 310, 310, 310,
+ 310, 310, 310, 310, 310, 310, 310, 310, 310, 310,
+ 310, 310, 310, 305, 305, 305, 312, 312, 310, 310,
+ 310, 310, 310, 310, 310, 310, 310, 310, 310, 310,
+ 310, 310, 305, 305, 305, 312, 312, 310, 310, 310,
+ 310, 310, 310, 310, 310, 310, 305, 305, 305, 312,
+ 312, 315, 249, 310, 310, 310, 310, 305, 305, 312,
+ 305, 310, 310, 310, 310, 305, 312, 305, 310, 310,
+ 312, 305, 310, 312, 305, 310, 305, 305, 310, 305,
+ 310, 305, 310, 305, 310, 305, 310, 305, 310, 305,
+
+ 310, 305, 310, 305, 0, 305, 305, 305, 305, 305,
+ 305, 305, 305, 305, 305
+ } ;
+
+static const flex_int16_t yy_nxt[454] =
+ { 0,
+ 16, 17, 18, 16, 19, 20, 16, 20, 21, 22,
+ 20, 20, 23, 24, 25, 26, 27, 28, 26, 26,
+ 29, 26, 30, 26, 31, 32, 26, 26, 33, 34,
+ 35, 36, 26, 26, 26, 20, 20, 37, 37, 16,
+ 38, 26, 38, 26, 40, 41, 26, 18, 304, 42,
+ 40, 41, 26, 18, 18, 42, 18, 39, 44, 39,
+ 44, 46, 39, 18, 18, 70, 73, 46, 39, 85,
+ 71, 304, 83, 74, 303, 75, 84, 48, 48, 49,
+ 49, 18, 50, 51, 49, 49, 49, 52, 61, 49,
+ 49, 64, 76, 108, 302, 54, 55, 85, 85, 62,
+
+ 78, 301, 79, 63, 65, 121, 300, 77, 109, 110,
+ 85, 157, 158, 122, 49, 49, 80, 81, 49, 49,
+ 49, 18, 50, 51, 49, 49, 49, 52, 124, 49,
+ 49, 129, 112, 132, 133, 54, 55, 196, 85, 85,
+ 299, 125, 178, 193, 298, 198, 109, 110, 109, 110,
+ 178, 297, 296, 295, 49, 49, 294, 293, 49, 199,
+ 262, 262, 262, 262, 262, 292, 291, 262, 263, 262,
+ 262, 290, 289, 288, 287, 286, 285, 284, 283, 282,
+ 281, 280, 279, 278, 277, 276, 275, 274, 273, 272,
+ 271, 270, 269, 268, 267, 266, 263, 263, 262, 43,
+
+ 43, 43, 43, 43, 45, 45, 45, 45, 45, 47,
+ 47, 47, 47, 47, 53, 53, 53, 53, 53, 60,
+ 60, 94, 94, 94, 94, 94, 98, 98, 101, 101,
+ 265, 101, 101, 136, 136, 264, 136, 136, 262, 262,
+ 262, 261, 260, 259, 258, 257, 256, 255, 254, 253,
+ 252, 251, 250, 249, 248, 247, 246, 245, 244, 243,
+ 242, 241, 240, 239, 238, 237, 236, 235, 234, 233,
+ 232, 231, 230, 229, 228, 227, 226, 225, 224, 223,
+ 222, 221, 220, 219, 218, 217, 216, 215, 214, 213,
+ 212, 211, 210, 209, 208, 207, 206, 205, 204, 203,
+
+ 202, 201, 200, 197, 195, 194, 192, 191, 190, 189,
+ 188, 187, 186, 185, 184, 183, 182, 181, 180, 179,
+ 178, 177, 176, 175, 174, 173, 172, 171, 170, 169,
+ 168, 167, 166, 165, 164, 128, 163, 162, 161, 160,
+ 159, 156, 155, 154, 153, 152, 151, 150, 149, 148,
+ 147, 146, 145, 144, 143, 142, 141, 140, 139, 138,
+ 137, 95, 135, 134, 131, 130, 128, 127, 126, 123,
+ 120, 119, 118, 117, 116, 115, 114, 113, 112, 111,
+ 107, 106, 105, 104, 103, 102, 59, 56, 100, 99,
+ 97, 96, 95, 93, 92, 91, 90, 89, 88, 87,
+
+ 86, 82, 72, 69, 68, 67, 66, 59, 58, 57,
+ 56, 305, 15, 305, 305, 305, 305, 305, 305, 305,
+ 305, 305, 305, 305, 305, 305, 305, 305, 305, 305,
+ 305, 305, 305, 305, 305, 305, 305, 305, 305, 305,
+ 305, 305, 305, 305, 305, 305, 305, 305, 305, 305,
+ 305, 305, 305
+ } ;
+
+static const flex_int16_t yy_chk[454] =
+ { 0,
+ 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,
+ 3, 3, 4, 4, 5, 5, 5, 9, 303, 5,
+ 6, 6, 6, 10, 7, 6, 8, 3, 7, 4,
+ 8, 9, 5, 11, 12, 30, 32, 10, 6, 37,
+ 30, 302, 36, 32, 301, 32, 36, 11, 12, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 23, 13,
+ 13, 24, 33, 67, 300, 13, 13, 37, 37, 23,
+
+ 34, 299, 34, 23, 24, 79, 298, 33, 67, 67,
+ 85, 121, 121, 79, 13, 13, 34, 34, 13, 14,
+ 14, 14, 14, 14, 14, 14, 14, 14, 81, 14,
+ 14, 86, 90, 89, 90, 14, 14, 167, 85, 85,
+ 297, 81, 164, 164, 296, 169, 86, 86, 89, 89,
+ 167, 295, 294, 293, 14, 14, 292, 291, 14, 169,
+ 249, 249, 249, 249, 249, 290, 289, 249, 249, 249,
+ 249, 288, 286, 285, 284, 283, 282, 281, 279, 278,
+ 277, 274, 272, 271, 270, 268, 267, 265, 264, 263,
+ 262, 260, 259, 257, 256, 254, 249, 249, 249, 306,
+
+ 306, 306, 306, 306, 307, 307, 307, 307, 307, 308,
+ 308, 308, 308, 308, 309, 309, 309, 309, 309, 310,
+ 310, 311, 311, 311, 311, 311, 312, 312, 313, 313,
+ 251, 313, 313, 314, 314, 250, 314, 314, 315, 315,
+ 315, 247, 246, 245, 244, 243, 241, 240, 239, 237,
+ 234, 233, 232, 231, 229, 228, 227, 226, 225, 224,
+ 223, 222, 220, 218, 217, 213, 211, 210, 209, 208,
+ 206, 205, 204, 203, 202, 201, 200, 199, 198, 197,
+ 196, 195, 193, 192, 191, 190, 189, 188, 187, 186,
+ 184, 183, 182, 181, 180, 179, 178, 177, 176, 173,
+
+ 172, 171, 170, 168, 166, 165, 163, 161, 160, 159,
+ 157, 156, 153, 152, 151, 150, 148, 147, 146, 145,
+ 144, 143, 142, 141, 140, 139, 138, 137, 135, 134,
+ 133, 132, 131, 130, 129, 128, 127, 126, 125, 124,
+ 123, 120, 119, 118, 117, 116, 115, 114, 113, 112,
+ 111, 110, 109, 108, 107, 106, 104, 103, 102, 100,
+ 99, 94, 93, 92, 88, 87, 84, 83, 82, 80,
+ 78, 77, 76, 75, 74, 72, 71, 70, 69, 68,
+ 66, 65, 64, 63, 62, 61, 59, 56, 55, 54,
+ 52, 51, 50, 48, 46, 44, 42, 41, 40, 39,
+
+ 38, 35, 31, 29, 28, 27, 25, 22, 21, 19,
+ 17, 15, 305, 305, 305, 305, 305, 305, 305, 305,
+ 305, 305, 305, 305, 305, 305, 305, 305, 305, 305,
+ 305, 305, 305, 305, 305, 305, 305, 305, 305, 305,
+ 305, 305, 305, 305, 305, 305, 305, 305, 305, 305,
+ 305, 305, 305
+ } ;
+
+static const flex_int16_t yy_rule_linenum[56] =
+ { 0,
+ 112, 113, 114, 115, 117, 118, 120, 121, 123, 124,
+ 126, 127, 128, 129, 131, 132, 133, 134, 135, 136,
+ 137, 139, 140, 141, 142, 143, 144, 146, 147, 148,
+ 150, 151, 152, 153, 154, 155, 157, 159, 161, 162,
+ 164, 165, 166, 167, 168, 169, 170, 172, 173, 174,
+ 176, 181, 182, 183, 185
+ } ;
+
+/* The intent behind this definition is that it'll catch
+ * any uses of REJECT which flex missed.
+ */
+#define REJECT reject_used_but_not_detected
+#define yymore() yymore_used_but_not_detected
+#define YY_MORE_ADJ 0
+#define YY_RESTORE_YY_MORE_OFFSET
+
+// Created: Thu Oct 28 12:21:16 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.
+
+/*****************************************************************************
+
+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 <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 "exptocas.tab.hxx" /* 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 ( const std::string& s, const std::string& text )
+{
+ printf ( "\nError at line %d: %s \"%s\"\n", ec_curline(), s.c_str(), text.c_str() );
+ return 0;
+}
+
+/*
+ c++ generate C++ parser class
+*/
+#define YY_NO_UNISTD_H 1
+
+
+
+
+// Tell flex which function to define
+#ifdef YY_DECL
+# undef YY_DECL
+#endif
+#define YY_DECL int exptocas::scanner::lex (exptocas::parser::semantic_type* yylval)
+
+typedef exptocas::parser::token token;
+
+/************************************/
+/* Section 2 */
+/* parsing rules */
+
+
+
+#define INITIAL 0
+#define TYP 1
+#define ENT 2
+#define COMM 3
+#define SKP 4
+#define RULE 5
+#define FUN 6
+
+
+
+
+
+#ifndef YY_NO_UNISTD_H
+/* Special case for "unistd.h", since it is non-ANSI. We include it way
+ * down here because we want the user's section 1 to have been scanned first.
+ * The user has a chance to override it with an option.
+ */
+/* %if-c-only */
+/* %endif */
+/* %if-c++-only */
+#include <unistd.h>
+/* %endif */
+#endif
+
+
+
+
+#ifndef YY_EXTRA_TYPE
+#define YY_EXTRA_TYPE void *
+#endif
+
+
+
+/* %if-c-only Reentrant structure and macros (non-C++). */
+/* %if-reentrant */
+/* %if-c-only */
+/* %endif */
+/* %if-reentrant */
+/* %endif */
+/* %endif End reentrant structures and macros. */
+/* %if-bison-bridge */
+/* %endif */
+/* %not-for-header */
+/* %ok-for-header */
+
+/* %endif */
+
+#ifndef yytext_ptr
+static void yy_flex_strncpy ( char *, const char *, int );
+#endif
+
+#ifdef YY_NEED_STRLEN
+static int yy_flex_strlen ( const char * );
+#endif
+
+#ifndef YY_NO_INPUT
+/* %if-c-only Standard (non-C++) definition */
+/* %not-for-header */
+/* %ok-for-header */
+
+/* %endif */
+#endif
+
+
+/* %if-c-only */
+/* %endif */
+
+/* Amount of stuff to slurp up with each read. */
+#ifndef YY_READ_BUF_SIZE
+#ifdef __ia64__
+/* On IA-64, the buffer size is 16k, not 8k */
+#define YY_READ_BUF_SIZE 16384
+#else
+#define YY_READ_BUF_SIZE 8192
+#endif /* __ia64__ */
+#endif
+
+
+/* Copy whatever the last rule matched to the standard output. */
+#ifndef ECHO
+/* %if-c-only Standard (non-C++) definition */
+/* %endif */
+/* %if-c++-only C++ definition */
+#define ECHO LexerOutput( yytext, yyleng )
+/* %endif */
+#endif
+
+
+
+/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
+ * is returned in "result".
+ */
+#ifndef YY_INPUT
+#define YY_INPUT(buf,result,max_size) \
+/* %% [5.0] fread()/read() definition of YY_INPUT goes here unless we're doing C++ \ */\
+\
+/* %if-c++-only C++ definition \ */\
+ if ( (int)(result = LexerInput( (char *) buf, max_size )) < 0 ) \
+ YY_FATAL_ERROR( "input in flex scanner failed" );
+/* %endif */
+
+#endif
+
+
+
+/* No semi-colon after return; correct usage is to write "yyterminate();" -
+ * we don't want an extra ';' after the "return" because that will cause
+ * some compilers to complain about unreachable statements.
+ */
+#ifndef yyterminate
+#define yyterminate() return YY_NULL
+#endif
+
+
+/* Number of entries by which start-condition stack grows. */
+#ifndef YY_START_STACK_INCR
+#define YY_START_STACK_INCR 25
+#endif
+
+
+/* Report a fatal error. */
+#ifndef YY_FATAL_ERROR
+/* %if-c-only */
+/* %endif */
+/* %if-c++-only */
+#define YY_FATAL_ERROR(msg) LexerError( msg )
+/* %endif */
+#endif
+
+
+/* %if-tables-serialization structures and prototypes */
+/* %not-for-header */
+/* %ok-for-header */
+
+/* %not-for-header */
+/* %tables-yydmap generated elements */
+/* %endif */
+/* end tables serialization structures and prototypes */
+
+/* %ok-for-header */
+
+
+/* Default declaration of generated scanner - a define so the user can
+ * easily add parameters.
+ */
+#ifndef YY_DECL
+#define YY_DECL_IS_OURS 1
+/* %if-c-only Standard (non-C++) definition */
+/* %endif */
+/* %if-c++-only C++ definition */
+#define YY_DECL int yyFlexLexer::yylex()
+/* %endif */
+#endif /* !YY_DECL */
+
+
+/* Code executed at the beginning of each rule, after yytext and yyleng
+ * have been set up.
+ */
+#ifndef YY_USER_ACTION
+#define YY_USER_ACTION
+#endif
+
+
+
+/* Code executed at the end of each rule. */
+#ifndef YY_BREAK
+#define YY_BREAK /*LINTED*/break;
+#endif
+
+
+
+/* %% [6.0] YY_RULE_SETUP definition goes here */
+#define YY_RULE_SETUP \
+ YY_USER_ACTION
+
+
+/* %not-for-header */
+/** The main scanner function which does all the work.
+ */
+YY_DECL
+{
+ yy_state_type yy_current_state;
+ char *yy_cp, *yy_bp;
+ int yy_act;
+
+
+
+
+
+
+
+
+
+
+ if ( !(yy_init) )
+ {
+ (yy_init) = 1;
+
+#ifdef YY_USER_INIT
+ YY_USER_INIT;
+#endif
+
+
+
+ if ( ! (yy_start) )
+ (yy_start) = 1; /* first start state */
+
+ if ( ! yyin )
+/* %if-c-only */
+/* %endif */
+/* %if-c++-only */
+ yyin.rdbuf(std::cin.rdbuf());
+/* %endif */
+
+ if ( ! yyout )
+/* %if-c-only */
+/* %endif */
+/* %if-c++-only */
+ yyout.rdbuf(std::cout.rdbuf());
+/* %endif */
+
+ if ( ! YY_CURRENT_BUFFER ) {
+ yyensure_buffer_stack ();
+ YY_CURRENT_BUFFER_LVALUE =
+ yy_create_buffer( yyin, YY_BUF_SIZE );
+ }
+
+ yy_load_buffer_state( );
+ }
+
+ {
+/* %% [7.0] user's declarations go here */
+
+
+
+ while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */
+ {
+/* %% [8.0] yymore()-related code goes here */
+ yy_cp = (yy_c_buf_p);
+
+ /* Support of yytext. */
+ *yy_cp = (yy_hold_char);
+
+ /* yy_bp points to the position in yy_ch_buf of the start of
+ * the current run.
+ */
+ yy_bp = yy_cp;
+
+/* %% [9.0] code to set up and find next match goes here */
+ yy_current_state = (yy_start);
+yy_match:
+ do
+ {
+ YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ;
+ if ( yy_accept[yy_current_state] )
+ {
+ (yy_last_accepting_state) = yy_current_state;
+ (yy_last_accepting_cpos) = yy_cp;
+ }
+ while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
+ {
+ yy_current_state = (int) yy_def[yy_current_state];
+ if ( yy_current_state >= 306 )
+ yy_c = yy_meta[yy_c];
+ }
+ yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
+ ++yy_cp;
+ }
+ while ( yy_base[yy_current_state] != 413 );
+
+yy_find_action:
+/* %% [10.0] code to find the action number goes here */
+ yy_act = yy_accept[yy_current_state];
+ if ( yy_act == 0 )
+ { /* have to back up */
+ yy_cp = (yy_last_accepting_cpos);
+ yy_current_state = (yy_last_accepting_state);
+ yy_act = yy_accept[yy_current_state];
+ }
+
+ YY_DO_BEFORE_ACTION;
+
+/* %% [11.0] code for yylineno update goes here */
+
+
+do_action: /* This label is used only to access EOF actions. */
+
+/* %% [12.0] debug code goes here */
+ if ( yy_flex_debug )
+ {
+ if ( yy_act == 0 )
+ std::cerr << "--scanner backing up\n";
+ else if ( yy_act < 56 )
+ std::cerr << "--accepting rule at line " << yy_rule_linenum[yy_act] <<
+ "(\"" << yytext << "\")\n";
+ else if ( yy_act == 56 )
+ std::cerr << "--accepting default rule (\"" << yytext << "\")\n";
+ else if ( yy_act == 57 )
+ std::cerr << "--(end of buffer or a NUL)\n";
+ else
+ std::cerr << "--EOF (start condition " << YY_START << ")\n";
+ }
+
+ switch ( yy_act )
+ { /* beginning of action switch */
+/* %% [13.0] actions go here */
+ case 0: /* must back up */
+ /* undo the effects of YY_DO_BEFORE_ACTION */
+ *yy_cp = (yy_hold_char);
+ yy_cp = (yy_last_accepting_cpos);
+ yy_current_state = (yy_last_accepting_state);
+ goto yy_find_action;
+
+case 1:
+YY_RULE_SETUP
+{ /* Eat line comments */ }
+ YY_BREAK
+case 2:
+YY_RULE_SETUP
+{ ec_state = YYSTATE; BEGIN(COMM); }
+ YY_BREAK
+case 3:
+YY_RULE_SETUP
+{ /* Eat multiline comments */ }
+ YY_BREAK
+case 4:
+YY_RULE_SETUP
+{ BEGIN(ec_state); }
+ YY_BREAK
+case 5:
+YY_RULE_SETUP
+{ return yylval->num = token::KSCHEM; }
+ YY_BREAK
+case 6:
+YY_RULE_SETUP
+{ return yylval->num = token::KENDS; }
+ YY_BREAK
+case 7:
+YY_RULE_SETUP
+{ BEGIN(TYP); return yylval->num = token::KTYP; }
+ YY_BREAK
+case 8:
+YY_RULE_SETUP
+{ BEGIN(0); return yylval->num = token::KENDT; }
+ YY_BREAK
+case 9:
+YY_RULE_SETUP
+{ BEGIN(ENT); return yylval->num = token::KENT; }
+ YY_BREAK
+case 10:
+YY_RULE_SETUP
+{ BEGIN(0); return yylval->num = token::KENDE; }
+ YY_BREAK
+case 11:
+case 12:
+case 13:
+YY_RULE_SETUP
+{ BEGIN(SKP); }
+ YY_BREAK
+case 14:
+YY_RULE_SETUP
+{ /* eat contents of WHERE and DERIVE subclauses of ENTITY and TYPE */ }
+ YY_BREAK
+case 15:
+YY_RULE_SETUP
+{ return yylval->num = token::KSEL; }
+ YY_BREAK
+case 16:
+YY_RULE_SETUP
+{ return yylval->num = token::KENUM; }
+ YY_BREAK
+case 17:
+YY_RULE_SETUP
+{ return yylval->num = token::KLIST; }
+ YY_BREAK
+case 18:
+YY_RULE_SETUP
+{ return yylval->num = token::KARR; }
+ YY_BREAK
+case 19:
+YY_RULE_SETUP
+{ return yylval->num = token::KSET; }
+ YY_BREAK
+case 20:
+YY_RULE_SETUP
+{ return yylval->num = token::KBAG; }
+ YY_BREAK
+case 21:
+YY_RULE_SETUP
+{ return yylval->num = token::KOF; }
+ YY_BREAK
+case 22:
+YY_RULE_SETUP
+{ return yylval->num = token::KNUM; }
+ YY_BREAK
+case 23:
+YY_RULE_SETUP
+{ return yylval->num = token::KINT; }
+ YY_BREAK
+case 24:
+YY_RULE_SETUP
+{ return yylval->num = token::KDBL; }
+ YY_BREAK
+case 25:
+YY_RULE_SETUP
+{ return yylval->num = token::KSTR; }
+ YY_BREAK
+case 26:
+YY_RULE_SETUP
+{ return yylval->num = token::KLOG; }
+ YY_BREAK
+case 27:
+YY_RULE_SETUP
+{ return yylval->num = token::KBOOL; }
+ YY_BREAK
+case 28:
+YY_RULE_SETUP
+{ return yylval->num = token::KOPT; }
+ YY_BREAK
+case 29:
+YY_RULE_SETUP
+{ return yylval->num = token::KUNIQ; }
+ YY_BREAK
+case 30:
+YY_RULE_SETUP
+{ return yylval->num = token::KSELF; }
+ YY_BREAK
+case 31:
+YY_RULE_SETUP
+{ return yylval->num = token::KABSTR; }
+ YY_BREAK
+case 32:
+YY_RULE_SETUP
+{ return yylval->num = token::KSUBT; }
+ YY_BREAK
+case 33:
+YY_RULE_SETUP
+{ return yylval->num = token::KSPRT; }
+ YY_BREAK
+case 34:
+YY_RULE_SETUP
+{ return yylval->num = token::KANDOR; }
+ YY_BREAK
+case 35:
+YY_RULE_SETUP
+{ return yylval->num = token::K1OF; }
+ YY_BREAK
+case 36:
+YY_RULE_SETUP
+{ return yylval->num = token::KAND; }
+ YY_BREAK
+case 37:
+YY_RULE_SETUP
+{ yylval->str = strdup ( yytext ); return token::NAME; }
+ YY_BREAK
+case 38:
+YY_RULE_SETUP
+{ yylval->str = strdup ( yytext ); return token::NAME; }
+ YY_BREAK
+case 39:
+YY_RULE_SETUP
+{ yylval->num = atoi ( yytext ); return token::NUMBER; }
+ YY_BREAK
+case 40:
+YY_RULE_SETUP
+{ return yylval->num = yytext[0]; }
+ YY_BREAK
+case 41:
+YY_RULE_SETUP
+{ BEGIN(FUN); fun_level++; }
+ YY_BREAK
+case 42:
+YY_RULE_SETUP
+{ ec_state = YYSTATE; BEGIN(COMM); /* eat comments in functions */ }
+ YY_BREAK
+case 43:
+YY_RULE_SETUP
+{ /* Eat line comments in functions */ }
+ YY_BREAK
+case 44:
+YY_RULE_SETUP
+{ /* eat FUNCTIONs - skip IDs explicitly */ }
+ YY_BREAK
+case 45:
+/* rule 45 can match eol */
+YY_RULE_SETUP
+{ /* eat FUNCTIONs - skip strings explicitly */ }
+ YY_BREAK
+case 46:
+YY_RULE_SETUP
+{ /* eat FUNCTIONs - skip all other symbols in functions */ }
+ YY_BREAK
+case 47:
+YY_RULE_SETUP
+{ fun_level--; if ( ! fun_level ) BEGIN(0); }
+ YY_BREAK
+case 48:
+YY_RULE_SETUP
+{ BEGIN(RULE); /* eat RULEs */ }
+ YY_BREAK
+case 49:
+YY_RULE_SETUP
+{ /* eat RULEs */ }
+ YY_BREAK
+case 50:
+YY_RULE_SETUP
+{ BEGIN(0); }
+ YY_BREAK
+case 51:
+/* rule 51 can match eol */
+YY_RULE_SETUP
+{ /* eat CONSTANTs */
+ char *s = yytext; /* but don't forget to count lines.. */
+ while ( *s ) if ( *(s++) == '\n' ) ec_linenum++;
+ }
+ YY_BREAK
+case 52:
+YY_RULE_SETUP
+{ /* eat spaces */ }
+ YY_BREAK
+case 53:
+YY_RULE_SETUP
+{ ec_error ( "unknown keyword ", yytext ); /* put unrecognized keywords to cerr */ }
+ YY_BREAK
+case 54:
+YY_RULE_SETUP
+{ ec_error ( "unknown symbol ", yytext ); /* put unrecognized data to cerr */ }
+ YY_BREAK
+case 55:
+/* rule 55 can match eol */
+YY_RULE_SETUP
+{ ec_linenum++; /* count lines */ }
+ YY_BREAK
+case 56:
+YY_RULE_SETUP
+ECHO;
+ YY_BREAK
+case YY_STATE_EOF(INITIAL):
+case YY_STATE_EOF(TYP):
+case YY_STATE_EOF(ENT):
+case YY_STATE_EOF(COMM):
+case YY_STATE_EOF(SKP):
+case YY_STATE_EOF(RULE):
+case YY_STATE_EOF(FUN):
+ yyterminate();
+
+ case YY_END_OF_BUFFER:
+ {
+ /* Amount of text matched not including the EOB char. */
+ int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1;
+
+ /* Undo the effects of YY_DO_BEFORE_ACTION. */
+ *yy_cp = (yy_hold_char);
+ YY_RESTORE_YY_MORE_OFFSET
+
+ if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
+ {
+ /* We're scanning a new file or input source. It's
+ * possible that this happened because the user
+ * just pointed yyin at a new source and called
+ * yylex(). If so, then we have to assure
+ * consistency between YY_CURRENT_BUFFER and our
+ * globals. Here is the right place to do so, because
+ * this is the first action (other than possibly a
+ * back-up) that will match for the new input source.
+ */
+ (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
+/* %if-c-only */
+/* %endif */
+/* %if-c++-only */
+ YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin.rdbuf();
+/* %endif */
+ YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
+ }
+
+ /* Note that here we test for yy_c_buf_p "<=" to the position
+ * of the first EOB in the buffer, since yy_c_buf_p will
+ * already have been incremented past the NUL character
+ * (since all states make transitions on EOB to the
+ * end-of-buffer state). Contrast this with the test
+ * in input().
+ */
+ if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
+ { /* This was really a NUL. */
+ yy_state_type yy_next_state;
+
+ (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
+
+ yy_current_state = yy_get_previous_state( );
+
+ /* Okay, we're now positioned to make the NUL
+ * transition. We couldn't have
+ * yy_get_previous_state() go ahead and do it
+ * for us because it doesn't know how to deal
+ * with the possibility of jamming (and we don't
+ * want to build jamming into it because then it
+ * will run more slowly).
+ */
+
+ yy_next_state = yy_try_NUL_trans( yy_current_state );
+
+ yy_bp = (yytext_ptr) + YY_MORE_ADJ;
+
+ if ( yy_next_state )
+ {
+ /* Consume the NUL. */
+ yy_cp = ++(yy_c_buf_p);
+ yy_current_state = yy_next_state;
+ goto yy_match;
+ }
+
+ else
+ {
+/* %% [14.0] code to do back-up for compressed tables and set up yy_cp goes here */
+ yy_cp = (yy_c_buf_p);
+ goto yy_find_action;
+ }
+ }
+
+ else switch ( yy_get_next_buffer( ) )
+ {
+ case EOB_ACT_END_OF_FILE:
+ {
+ (yy_did_buffer_switch_on_eof) = 0;
+
+ if ( yywrap( ) )
+ {
+ /* Note: because we've taken care in
+ * yy_get_next_buffer() to have set up
+ * yytext, we can now set up
+ * yy_c_buf_p so that if some total
+ * hoser (like flex itself) wants to
+ * call the scanner after we return the
+ * YY_NULL, it'll still work - another
+ * YY_NULL will get returned.
+ */
+ (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ;
+
+ yy_act = YY_STATE_EOF(YY_START);
+ goto do_action;
+ }
+
+ else
+ {
+ if ( ! (yy_did_buffer_switch_on_eof) )
+ YY_NEW_FILE;
+ }
+ break;
+ }
+
+ case EOB_ACT_CONTINUE_SCAN:
+ (yy_c_buf_p) =
+ (yytext_ptr) + yy_amount_of_matched_text;
+
+ yy_current_state = yy_get_previous_state( );
+
+ yy_cp = (yy_c_buf_p);
+ yy_bp = (yytext_ptr) + YY_MORE_ADJ;
+ goto yy_match;
+
+ case EOB_ACT_LAST_MATCH:
+ (yy_c_buf_p) =
+ &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];
+
+ yy_current_state = yy_get_previous_state( );
+
+ yy_cp = (yy_c_buf_p);
+ yy_bp = (yytext_ptr) + YY_MORE_ADJ;
+ goto yy_find_action;
+ }
+ break;
+ }
+
+ default:
+ YY_FATAL_ERROR(
+ "fatal flex scanner internal error--no action found" );
+ } /* end of action switch */
+ } /* end of scanning one token */
+ } /* end of user's declarations */
+} /* end of yylex */
+/* %ok-for-header */
+
+
+/* %if-c++-only */
+/* %not-for-header */
+/* The contents of this function are C++ specific, so the () macro is not used.
+ * This constructor simply maintains backward compatibility.
+ * DEPRECATED
+ */
+yyFlexLexer::yyFlexLexer( std::istream* arg_yyin, std::ostream* arg_yyout ):
+ yyin(arg_yyin ? arg_yyin->rdbuf() : std::cin.rdbuf()),
+ yyout(arg_yyout ? arg_yyout->rdbuf() : std::cout.rdbuf())
+{
+ ctor_common();
+}
+
+/* The contents of this function are C++ specific, so the () macro is not used.
+ */
+yyFlexLexer::yyFlexLexer( std::istream& arg_yyin, std::ostream& arg_yyout ):
+ yyin(arg_yyin.rdbuf()),
+ yyout(arg_yyout.rdbuf())
+{
+ ctor_common();
+}
+
+/* The contents of this function are C++ specific, so the () macro is not used.
+ */
+void yyFlexLexer::ctor_common()
+{
+ yy_c_buf_p = 0;
+ yy_init = 0;
+ yy_start = 0;
+ yy_flex_debug = 0;
+ yylineno = 1; // this will only get updated if %option yylineno
+
+ yy_did_buffer_switch_on_eof = 0;
+
+ yy_looking_for_trail_begin = 0;
+ yy_more_flag = 0;
+ yy_more_len = 0;
+ yy_more_offset = yy_prev_more_offset = 0;
+
+ yy_start_stack_ptr = yy_start_stack_depth = 0;
+ yy_start_stack = NULL;
+
+ yy_buffer_stack = NULL;
+ yy_buffer_stack_top = 0;
+ yy_buffer_stack_max = 0;
+
+
+
+ yy_state_buf = 0;
+
+}
+
+/* The contents of this function are C++ specific, so the () macro is not used.
+ */
+yyFlexLexer::~yyFlexLexer()
+{
+ delete [] yy_state_buf;
+ yyfree( yy_start_stack );
+ yy_delete_buffer( YY_CURRENT_BUFFER );
+ yyfree( yy_buffer_stack );
+}
+
+/* The contents of this function are C++ specific, so the () macro is not used.
+ */
+void yyFlexLexer::switch_streams( std::istream& new_in, std::ostream& new_out )
+{
+ // was if( new_in )
+ yy_delete_buffer( YY_CURRENT_BUFFER );
+ yy_switch_to_buffer( yy_create_buffer( new_in, YY_BUF_SIZE ) );
+
+ // was if( new_out )
+ yyout.rdbuf(new_out.rdbuf());
+}
+
+/* The contents of this function are C++ specific, so the () macro is not used.
+ */
+void yyFlexLexer::switch_streams( std::istream* new_in, std::ostream* new_out )
+{
+ if( ! new_in ) {
+ new_in = &yyin;
+ }
+
+ if ( ! new_out ) {
+ new_out = &yyout;
+ }
+
+ switch_streams(*new_in, *new_out);
+}
+
+#ifdef YY_INTERACTIVE
+int yyFlexLexer::LexerInput( char* buf, int /* max_size */ )
+#else
+int yyFlexLexer::LexerInput( char* buf, int max_size )
+#endif
+{
+ if ( yyin.eof() || yyin.fail() )
+ return 0;
+
+#ifdef YY_INTERACTIVE
+ yyin.get( buf[0] );
+
+ if ( yyin.eof() )
+ return 0;
+
+ if ( yyin.bad() )
+ return -1;
+
+ return 1;
+
+#else
+ (void) yyin.read( buf, max_size );
+
+ if ( yyin.bad() )
+ return -1;
+ else
+ return yyin.gcount();
+#endif
+}
+
+void yyFlexLexer::LexerOutput( const char* buf, int size )
+{
+ (void) yyout.write( buf, size );
+}
+/* %ok-for-header */
+
+/* %endif */
+
+
+/* yy_get_next_buffer - try to read in a new buffer
+ *
+ * Returns a code representing an action:
+ * EOB_ACT_LAST_MATCH -
+ * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
+ * EOB_ACT_END_OF_FILE - end of file
+ */
+/* %if-c-only */
+/* %endif */
+/* %if-c++-only */
+int yyFlexLexer::yy_get_next_buffer()
+/* %endif */
+{
+ char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
+ char *source = (yytext_ptr);
+ int number_to_move, i;
+ int ret_val;
+
+ if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
+ YY_FATAL_ERROR(
+ "fatal flex scanner internal error--end of buffer missed" );
+
+ if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
+ { /* Don't try to fill the buffer, so this is an EOF. */
+ if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 )
+ {
+ /* We matched a single character, the EOB, so
+ * treat this as a final EOF.
+ */
+ return EOB_ACT_END_OF_FILE;
+ }
+
+ else
+ {
+ /* We matched some text prior to the EOB, first
+ * process it.
+ */
+ return EOB_ACT_LAST_MATCH;
+ }
+ }
+
+ /* Try to read more data. */
+
+ /* First move last chars to start of buffer. */
+ number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr) - 1);
+
+ for ( i = 0; i < number_to_move; ++i )
+ *(dest++) = *(source++);
+
+ if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
+ /* don't do the read, it's not guaranteed to return an EOF,
+ * just force an EOF
+ */
+ YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
+
+ else
+ {
+ int num_to_read =
+ YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
+
+ while ( num_to_read <= 0 )
+ { /* Not enough room in the buffer - grow it. */
+
+ /* just a shorter name for the current buffer */
+ YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE;
+
+ int yy_c_buf_p_offset =
+ (int) ((yy_c_buf_p) - b->yy_ch_buf);
+
+ if ( b->yy_is_our_buffer )
+ {
+ int new_size = b->yy_buf_size * 2;
+
+ if ( new_size <= 0 )
+ b->yy_buf_size += b->yy_buf_size / 8;
+ else
+ b->yy_buf_size *= 2;
+
+ b->yy_ch_buf = (char *)
+ /* Include room in for 2 EOB chars. */
+ yyrealloc( (void *) b->yy_ch_buf,
+ (yy_size_t) (b->yy_buf_size + 2) );
+ }
+ else
+ /* Can't grow it, we don't own it. */
+ b->yy_ch_buf = NULL;
+
+ if ( ! b->yy_ch_buf )
+ YY_FATAL_ERROR(
+ "fatal error - scanner input buffer overflow" );
+
+ (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
+
+ num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
+ number_to_move - 1;
+
+ }
+
+ if ( num_to_read > YY_READ_BUF_SIZE )
+ num_to_read = YY_READ_BUF_SIZE;
+
+ /* Read in more data. */
+ YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
+ (yy_n_chars), num_to_read );
+
+ YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
+ }
+
+ if ( (yy_n_chars) == 0 )
+ {
+ if ( number_to_move == YY_MORE_ADJ )
+ {
+ ret_val = EOB_ACT_END_OF_FILE;
+ yyrestart( yyin );
+ }
+
+ else
+ {
+ ret_val = EOB_ACT_LAST_MATCH;
+ YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
+ YY_BUFFER_EOF_PENDING;
+ }
+ }
+
+ else
+ ret_val = EOB_ACT_CONTINUE_SCAN;
+
+ if (((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
+ /* Extend the array by 50%, plus the number we really need. */
+ int new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
+ YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc(
+ (void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf, (yy_size_t) new_size );
+ if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
+ YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
+ /* "- 2" to take care of EOB's */
+ YY_CURRENT_BUFFER_LVALUE->yy_buf_size = (int) (new_size - 2);
+ }
+
+ (yy_n_chars) += number_to_move;
+ YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
+ YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
+
+ (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
+
+ return ret_val;
+}
+
+
+/* yy_get_previous_state - get the state just before the EOB char was reached */
+
+/* %if-c-only */
+/* %not-for-header */
+/* %endif */
+/* %if-c++-only */
+ yy_state_type yyFlexLexer::yy_get_previous_state()
+/* %endif */
+{
+ yy_state_type yy_current_state;
+ char *yy_cp;
+
+/* %% [15.0] code to get the start state into yy_current_state goes here */
+ yy_current_state = (yy_start);
+
+ for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
+ {
+/* %% [16.0] code to find the next state goes here */
+ YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
+ if ( yy_accept[yy_current_state] )
+ {
+ (yy_last_accepting_state) = yy_current_state;
+ (yy_last_accepting_cpos) = yy_cp;
+ }
+ while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
+ {
+ yy_current_state = (int) yy_def[yy_current_state];
+ if ( yy_current_state >= 306 )
+ yy_c = yy_meta[yy_c];
+ }
+ yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
+ }
+
+ return yy_current_state;
+}
+
+
+/* yy_try_NUL_trans - try to make a transition on the NUL character
+ *
+ * synopsis
+ * next_state = yy_try_NUL_trans( current_state );
+ */
+/* %if-c-only */
+/* %endif */
+/* %if-c++-only */
+ yy_state_type yyFlexLexer::yy_try_NUL_trans( yy_state_type yy_current_state )
+/* %endif */
+{
+ int yy_is_jam;
+ /* %% [17.0] code to find the next state, and perhaps do backing up, goes here */
+ char *yy_cp = (yy_c_buf_p);
+
+ YY_CHAR yy_c = 1;
+ if ( yy_accept[yy_current_state] )
+ {
+ (yy_last_accepting_state) = yy_current_state;
+ (yy_last_accepting_cpos) = yy_cp;
+ }
+ while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
+ {
+ yy_current_state = (int) yy_def[yy_current_state];
+ if ( yy_current_state >= 306 )
+ yy_c = yy_meta[yy_c];
+ }
+ yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
+ yy_is_jam = (yy_current_state == 305);
+
+ return yy_is_jam ? 0 : yy_current_state;
+}
+
+
+#ifndef YY_NO_UNPUT
+/* %if-c-only */
+/* %endif */
+/* %if-c++-only */
+ void yyFlexLexer::yyunput( int c, char* yy_bp)
+/* %endif */
+{
+ char *yy_cp;
+
+ yy_cp = (yy_c_buf_p);
+
+ /* undo effects of setting up yytext */
+ *yy_cp = (yy_hold_char);
+
+ if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
+ { /* need to shift things up to make room */
+ /* +2 for EOB chars. */
+ int number_to_move = (yy_n_chars) + 2;
+ char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
+ YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
+ char *source =
+ &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move];
+
+ while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
+ *--dest = *--source;
+
+ yy_cp += (int) (dest - source);
+ yy_bp += (int) (dest - source);
+ YY_CURRENT_BUFFER_LVALUE->yy_n_chars =
+ (yy_n_chars) = (int) YY_CURRENT_BUFFER_LVALUE->yy_buf_size;
+
+ if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
+ YY_FATAL_ERROR( "flex scanner push-back overflow" );
+ }
+
+ *--yy_cp = (char) c;
+
+/* %% [18.0] update yylineno here */
+
+
+ (yytext_ptr) = yy_bp;
+ (yy_hold_char) = *yy_cp;
+ (yy_c_buf_p) = yy_cp;
+}
+/* %if-c-only */
+/* %endif */
+#endif
+
+/* %if-c-only */
+/* %endif */
+/* %if-c++-only */
+ int yyFlexLexer::yyinput()
+/* %endif */
+{
+ int c;
+
+ *(yy_c_buf_p) = (yy_hold_char);
+
+ if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
+ {
+ /* yy_c_buf_p now points to the character we want to return.
+ * If this occurs *before* the EOB characters, then it's a
+ * valid NUL; if not, then we've hit the end of the buffer.
+ */
+ if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
+ /* This was really a NUL. */
+ *(yy_c_buf_p) = '\0';
+
+ else
+ { /* need more input */
+ int offset = (int) ((yy_c_buf_p) - (yytext_ptr));
+ ++(yy_c_buf_p);
+
+ switch ( yy_get_next_buffer( ) )
+ {
+ case EOB_ACT_LAST_MATCH:
+ /* This happens because yy_g_n_b()
+ * sees that we've accumulated a
+ * token and flags that we need to
+ * try matching the token before
+ * proceeding. But for input(),
+ * there's no matching to consider.
+ * So convert the EOB_ACT_LAST_MATCH
+ * to EOB_ACT_END_OF_FILE.
+ */
+
+ /* Reset buffer status. */
+ yyrestart( yyin );
+
+ /*FALLTHROUGH*/
+
+ case EOB_ACT_END_OF_FILE:
+ {
+ if ( yywrap( ) )
+ return 0;
+
+ if ( ! (yy_did_buffer_switch_on_eof) )
+ YY_NEW_FILE;
+#ifdef __cplusplus
+ return yyinput();
+#else
+ return input();
+#endif
+ }
+
+ case EOB_ACT_CONTINUE_SCAN:
+ (yy_c_buf_p) = (yytext_ptr) + offset;
+ break;
+ }
+ }
+ }
+
+ c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */
+ *(yy_c_buf_p) = '\0'; /* preserve yytext */
+ (yy_hold_char) = *++(yy_c_buf_p);
+
+/* %% [19.0] update BOL and yylineno */
+
+ return c;
+}
+/* %if-c-only */
+/* %endif */
+
+/** Immediately switch to a different input stream.
+ * @param input_file A readable stream.
+ *
+ * @note This function does not reset the start condition to @c INITIAL .
+ */
+/* %if-c-only */
+/* %endif */
+/* %if-c++-only */
+ void yyFlexLexer::yyrestart( std::istream& input_file )
+/* %endif */
+{
+
+ if ( ! YY_CURRENT_BUFFER ){
+ yyensure_buffer_stack ();
+ YY_CURRENT_BUFFER_LVALUE =
+ yy_create_buffer( yyin, YY_BUF_SIZE );
+ }
+
+ yy_init_buffer( YY_CURRENT_BUFFER, input_file );
+ yy_load_buffer_state( );
+}
+
+/* %if-c++-only */
+/** Delegate to the new version that takes an istream reference.
+ * @param input_file A readable stream.
+ *
+ * @note This function does not reset the start condition to @c INITIAL .
+ */
+void yyFlexLexer::yyrestart( std::istream* input_file )
+{
+ if( ! input_file ) {
+ input_file = &yyin;
+ }
+ yyrestart( *input_file );
+}
+/* %endif */
+
+/** Switch to a different input buffer.
+ * @param new_buffer The new input buffer.
+ *
+ */
+/* %if-c-only */
+/* %endif */
+/* %if-c++-only */
+ void yyFlexLexer::yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )
+/* %endif */
+{
+
+ /* TODO. We should be able to replace this entire function body
+ * with
+ * yypop_buffer_state();
+ * yypush_buffer_state(new_buffer);
+ */
+ yyensure_buffer_stack ();
+ if ( YY_CURRENT_BUFFER == new_buffer )
+ return;
+
+ if ( YY_CURRENT_BUFFER )
+ {
+ /* Flush out information for old buffer. */
+ *(yy_c_buf_p) = (yy_hold_char);
+ YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
+ YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
+ }
+
+ YY_CURRENT_BUFFER_LVALUE = new_buffer;
+ yy_load_buffer_state( );
+
+ /* We don't actually know whether we did this switch during
+ * EOF (yywrap()) processing, but the only time this flag
+ * is looked at is after yywrap() is called, so it's safe
+ * to go ahead and always set it.
+ */
+ (yy_did_buffer_switch_on_eof) = 1;
+}
+
+
+/* %if-c-only */
+/* %endif */
+/* %if-c++-only */
+ void yyFlexLexer::yy_load_buffer_state()
+/* %endif */
+{
+ (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
+ (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
+/* %if-c-only */
+/* %endif */
+/* %if-c++-only */
+ yyin.rdbuf(YY_CURRENT_BUFFER_LVALUE->yy_input_file);
+/* %endif */
+ (yy_hold_char) = *(yy_c_buf_p);
+}
+
+/** Allocate and initialize an input buffer state.
+ * @param file A readable stream.
+ * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
+ *
+ * @return the allocated buffer state.
+ */
+/* %if-c-only */
+/* %endif */
+/* %if-c++-only */
+ YY_BUFFER_STATE yyFlexLexer::yy_create_buffer( std::istream& file, int size )
+/* %endif */
+{
+ YY_BUFFER_STATE b;
+
+ b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) );
+ if ( ! b )
+ YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
+
+ b->yy_buf_size = size;
+
+ /* yy_ch_buf has to be 2 characters longer than the size given because
+ * we need to put in 2 end-of-buffer characters.
+ */
+ b->yy_ch_buf = (char *) yyalloc( (yy_size_t) (b->yy_buf_size + 2) );
+ if ( ! b->yy_ch_buf )
+ YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
+
+ b->yy_is_our_buffer = 1;
+
+ yy_init_buffer( b, file );
+
+ return b;
+}
+
+/* %if-c++-only */
+/** Delegate creation of buffers to the new version that takes an istream reference.
+ * @param file A readable stream.
+ * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
+ *
+ * @return the allocated buffer state.
+ */
+ YY_BUFFER_STATE yyFlexLexer::yy_create_buffer( std::istream* file, int size )
+{
+ return yy_create_buffer( *file, size );
+}
+/* %endif */
+
+/** Destroy the buffer.
+ * @param b a buffer created with yy_create_buffer()
+ *
+ */
+/* %if-c-only */
+/* %endif */
+/* %if-c++-only */
+ void yyFlexLexer::yy_delete_buffer( YY_BUFFER_STATE b )
+/* %endif */
+{
+
+ if ( ! b )
+ return;
+
+ if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
+ YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
+
+ if ( b->yy_is_our_buffer )
+ yyfree( (void *) b->yy_ch_buf );
+
+ yyfree( (void *) b );
+}
+
+
+/* Initializes or reinitializes a buffer.
+ * This function is sometimes called more than once on the same buffer,
+ * such as during a yyrestart() or at EOF.
+ */
+/* %if-c-only */
+/* %endif */
+/* %if-c++-only */
+ void yyFlexLexer::yy_init_buffer( YY_BUFFER_STATE b, std::istream& file )
+/* %endif */
+
+{
+ int oerrno = errno;
+
+ yy_flush_buffer( b );
+
+/* %if-c-only */
+/* %endif */
+/* %if-c++-only */
+ b->yy_input_file = file.rdbuf();
+/* %endif */
+ b->yy_fill_buffer = 1;
+
+ /* If b is the current buffer, then yy_init_buffer was _probably_
+ * called from yyrestart() or through yy_get_next_buffer.
+ * In that case, we don't want to reset the lineno or column.
+ */
+ if (b != YY_CURRENT_BUFFER){
+ b->yy_bs_lineno = 1;
+ b->yy_bs_column = 0;
+ }
+
+/* %if-c-only */
+/* %endif */
+/* %if-c++-only */
+ b->yy_is_interactive = 0;
+/* %endif */
+ errno = oerrno;
+}
+
+/** Discard all buffered characters. On the next scan, YY_INPUT will be called.
+ * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
+ *
+ */
+/* %if-c-only */
+/* %endif */
+/* %if-c++-only */
+ void yyFlexLexer::yy_flush_buffer( YY_BUFFER_STATE b )
+/* %endif */
+{
+ if ( ! b )
+ return;
+
+ b->yy_n_chars = 0;
+
+ /* We always need two end-of-buffer characters. The first causes
+ * a transition to the end-of-buffer state. The second causes
+ * a jam in that state.
+ */
+ b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
+ b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
+
+ b->yy_buf_pos = &b->yy_ch_buf[0];
+
+ b->yy_at_bol = 1;
+ b->yy_buffer_status = YY_BUFFER_NEW;
+
+ if ( b == YY_CURRENT_BUFFER )
+ yy_load_buffer_state( );
+}
+
+/* %if-c-or-c++ */
+/** Pushes the new state onto the stack. The new state becomes
+ * the current state. This function will allocate the stack
+ * if necessary.
+ * @param new_buffer The new state.
+ *
+ */
+/* %if-c-only */
+/* %endif */
+/* %if-c++-only */
+void yyFlexLexer::yypush_buffer_state (YY_BUFFER_STATE new_buffer)
+/* %endif */
+{
+ if (new_buffer == NULL)
+ return;
+
+ yyensure_buffer_stack();
+
+ /* This block is copied from yy_switch_to_buffer. */
+ if ( YY_CURRENT_BUFFER )
+ {
+ /* Flush out information for old buffer. */
+ *(yy_c_buf_p) = (yy_hold_char);
+ YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
+ YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
+ }
+
+ /* Only push if top exists. Otherwise, replace top. */
+ if (YY_CURRENT_BUFFER)
+ (yy_buffer_stack_top)++;
+ YY_CURRENT_BUFFER_LVALUE = new_buffer;
+
+ /* copied from yy_switch_to_buffer. */
+ yy_load_buffer_state( );
+ (yy_did_buffer_switch_on_eof) = 1;
+}
+/* %endif */
+
+
+/* %if-c-or-c++ */
+/** Removes and deletes the top of the stack, if present.
+ * The next element becomes the new top.
+ *
+ */
+/* %if-c-only */
+/* %endif */
+/* %if-c++-only */
+void yyFlexLexer::yypop_buffer_state (void)
+/* %endif */
+{
+ if (!YY_CURRENT_BUFFER)
+ return;
+
+ yy_delete_buffer(YY_CURRENT_BUFFER );
+ YY_CURRENT_BUFFER_LVALUE = NULL;
+ if ((yy_buffer_stack_top) > 0)
+ --(yy_buffer_stack_top);
+
+ if (YY_CURRENT_BUFFER) {
+ yy_load_buffer_state( );
+ (yy_did_buffer_switch_on_eof) = 1;
+ }
+}
+/* %endif */
+
+
+/* %if-c-or-c++ */
+/* Allocates the stack if it does not exist.
+ * Guarantees space for at least one push.
+ */
+/* %if-c-only */
+/* %endif */
+/* %if-c++-only */
+void yyFlexLexer::yyensure_buffer_stack(void)
+/* %endif */
+{
+ yy_size_t num_to_alloc;
+
+ if (!(yy_buffer_stack)) {
+
+ /* First allocation is just for 2 elements, since we don't know if this
+ * scanner will even need a stack. We use 2 instead of 1 to avoid an
+ * immediate realloc on the next call.
+ */
+ num_to_alloc = 1; /* After all that talk, this was set to 1 anyways... */
+ (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc
+ (num_to_alloc * sizeof(struct yy_buffer_state*)
+ );
+ if ( ! (yy_buffer_stack) )
+ YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
+
+
+ memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
+
+ (yy_buffer_stack_max) = num_to_alloc;
+ (yy_buffer_stack_top) = 0;
+ return;
+ }
+
+ if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){
+
+ /* Increase the buffer to prepare for a possible push. */
+ yy_size_t grow_size = 8 /* arbitrary grow size */;
+
+ num_to_alloc = (yy_buffer_stack_max) + grow_size;
+ (yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc
+ ((yy_buffer_stack),
+ num_to_alloc * sizeof(struct yy_buffer_state*)
+ );
+ if ( ! (yy_buffer_stack) )
+ YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
+
+ /* zero only the new slots.*/
+ memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
+ (yy_buffer_stack_max) = num_to_alloc;
+ }
+}
+/* %endif */
+
+
+
+
+
+/* %if-c-only */
+/* %endif */
+
+
+
+
+/* %if-c-only */
+/* %endif */
+
+
+
+
+/* %if-c-only */
+/* %endif */
+
+
+
+
+/* %if-c-only */
+/* %endif */
+/* %if-c++-only */
+ void yyFlexLexer::yy_push_state( int _new_state )
+/* %endif */
+{
+ if ( (yy_start_stack_ptr) >= (yy_start_stack_depth) )
+ {
+ yy_size_t new_size;
+
+ (yy_start_stack_depth) += YY_START_STACK_INCR;
+ new_size = (yy_size_t) (yy_start_stack_depth) * sizeof( int );
+
+ if ( ! (yy_start_stack) )
+ (yy_start_stack) = (int *) yyalloc( new_size );
+
+ else
+ (yy_start_stack) = (int *) yyrealloc(
+ (void *) (yy_start_stack), new_size );
+
+ if ( ! (yy_start_stack) )
+ YY_FATAL_ERROR( "out of memory expanding start-condition stack" );
+ }
+
+ (yy_start_stack)[(yy_start_stack_ptr)++] = YY_START;
+
+ BEGIN(_new_state);
+}
+
+
+
+
+/* %if-c-only */
+/* %endif */
+/* %if-c++-only */
+ void yyFlexLexer::yy_pop_state()
+/* %endif */
+{
+ if ( --(yy_start_stack_ptr) < 0 )
+ YY_FATAL_ERROR( "start-condition stack underflow" );
+
+ BEGIN((yy_start_stack)[(yy_start_stack_ptr)]);
+}
+
+
+
+
+/* %if-c-only */
+/* %endif */
+/* %if-c++-only */
+ int yyFlexLexer::yy_top_state()
+/* %endif */
+{
+ return (yy_start_stack)[(yy_start_stack_ptr) - 1];
+}
+
+
+#ifndef YY_EXIT_FAILURE
+#define YY_EXIT_FAILURE 2
+#endif
+
+/* %if-c-only */
+/* %endif */
+/* %if-c++-only */
+void yyFlexLexer::LexerError( const char* msg )
+{
+ std::cerr << msg << std::endl;
+ exit( YY_EXIT_FAILURE );
+}
+/* %endif */
+
+/* Redefine yyless() so it works in section 3 code. */
+
+#undef yyless
+#define yyless(n) \
+ do \
+ { \
+ /* Undo effects of setting up yytext. */ \
+ int yyless_macro_arg = (n); \
+ YY_LESS_LINENO(yyless_macro_arg);\
+ yytext[yyleng] = (yy_hold_char); \
+ (yy_c_buf_p) = yytext + yyless_macro_arg; \
+ (yy_hold_char) = *(yy_c_buf_p); \
+ *(yy_c_buf_p) = '\0'; \
+ yyleng = yyless_macro_arg; \
+ } \
+ while ( 0 )
+
+
+
+/* Accessor methods (get/set functions) to struct members. */
+
+/* %if-c-only */
+/* %if-reentrant */
+/* %endif */
+/* %if-reentrant */
+/* %endif */
+/* %endif */
+
+/* %if-reentrant */
+/* %if-bison-bridge */
+/* %endif */
+/* %endif if-c-only */
+
+/* %if-c-only */
+/* %endif */
+
+
+/* %if-c-only SNIP! this currently causes conflicts with the c++ scanner */
+/* %if-reentrant */
+/* %endif */
+/* %endif */
+
+
+
+/*
+ * Internal utility routines.
+ */
+
+
+
+#ifndef yytext_ptr
+static void yy_flex_strncpy (char* s1, const char * s2, int n )
+{
+
+ int i;
+ for ( i = 0; i < n; ++i )
+ s1[i] = s2[i];
+}
+#endif
+
+
+
+#ifdef YY_NEED_STRLEN
+static int yy_flex_strlen (const char * s )
+{
+ int n;
+ for ( n = 0; s[n]; ++n )
+ ;
+
+ return n;
+}
+#endif
+
+
+
+void *yyalloc (yy_size_t size )
+{
+ return malloc(size);
+}
+
+
+
+void *yyrealloc (void * ptr, yy_size_t size )
+{
+
+ /* The cast to (char *) in the following accommodates both
+ * implementations that use char* generic pointers, and those
+ * that use void* generic pointers. It works with the latter
+ * because both ANSI C and C++ allow castless assignment from
+ * any pointer type to void*, and deal with argument conversions
+ * as though doing an assignment.
+ */
+ return realloc(ptr, size);
+}
+
+
+
+void yyfree (void * ptr )
+{
+ free( (char *) ptr ); /* see yyrealloc() for (char *) cast */
+}
+
+
+/* %if-tables-serialization definitions */
+/* %define-yytables The name for this specific scanner's tables. */
+#define YYTABLES_NAME "yytables"
+/* %endif */
+
+
+
+
+/* %ok-for-header */
+
+
+
+
+/************************************/
+/* Section 3 */
+/* auxiliary procedures */
+
+exptocas::scanner::scanner(std::istream* in, std::ostream* out)
+ : exptocasFlexLexer(in, out)
+{
+}
+
+/*
+int main ( void )
+{
+ yylex();
+}
+*/
+
+
--- /dev/null
+# Last update 03.04.2020
+#===============================================
+# package StepAP203
+#===============================================
+ApprovedItem StepAP203
+CcDesignApproval StepAP203
+CcDesignCertification StepAP203
+CcDesignContract StepAP203
+CcDesignDateAndTimeAssignment StepAP203
+CcDesignPersonAndOrganizationAssignment StepAP203
+CcDesignSecurityClassification StepAP203
+CcDesignSpecificationReference StepAP203
+CertifiedItem StepAP203
+Change StepAP203
+ChangeRequest StepAP203
+ChangeRequestItem StepAP203
+ClassifiedItem StepAP203
+ContractedItem StepAP203
+DateTimeItem StepAP203
+PersonOrganizationItem StepAP203
+SpecifiedItem StepAP203
+StartRequest StepAP203
+StartRequestItem StepAP203
+StartWork StepAP203
+WorkItem StepAP203
+
+#===============================================
+# package StepAP214
+#===============================================
+AppliedApprovalAssignment StepAP214
+AppliedDateAndTimeAssignment StepAP214
+AppliedDateAssignment StepAP214
+AppliedDocumentReference StepAP214
+AppliedExternalIdentificationAssignment StepAP214
+AppliedGroupAssignment StepAP214
+AppliedOrganizationAssignment StepAP214
+AppliedPersonAndOrganizationAssignment StepAP214
+AppliedPresentedItem StepAP214
+AppliedSecurityClassificationAssignment StepAP214
+ApprovalItem StepAP214
+AutoDesignActualDateAndTimeAssignment StepAP214
+AutoDesignActualDateAssignment StepAP214
+AutoDesignApprovalAssignment StepAP214
+AutoDesignDateAndPersonAssignment StepAP214
+AutoDesignDateAndPersonItem StepAP214
+AutoDesignDateAndTimeItem StepAP214
+AutoDesignDatedItem StepAP214
+AutoDesignDocumentReference StepAP214
+AutoDesignGeneralOrgItem StepAP214
+AutoDesignGroupAssignment StepAP214
+AutoDesignGroupedItem StepAP214
+AutoDesignNominalDateAndTimeAssignment StepAP214
+AutoDesignNominalDateAssignment StepAP214
+AutoDesignOrganizationAssignment StepAP214
+AutoDesignOrganizationItem StepAP214
+AutoDesignPersonAndOrganizationAssignment StepAP214
+AutoDesignPresentedItem StepAP214
+AutoDesignPresentedItemSelect StepAP214
+AutoDesignReferencingItem StepAP214
+AutoDesignSecurityClassificationAssignment StepAP214
+Class StepAP214
+DateAndTimeItem StepAP214
+DateItem StepAP214
+DocumentReferenceItem StepAP214
+ExternalIdentificationItem StepAP214
+ExternallyDefinedClass StepAP214
+ExternallyDefinedGeneralProperty StepAP214
+GroupItem StepAP214
+OrganizationItem StepAP214
+PersonAndOrganizationItem StepAP214
+PresentedItemSelect StepAP214
+Protocol StepAP214
+RepItemGroup StepAP214
+SecurityClassificationItem StepAP214
+
+#===============================================
+# package StepAP242
+#===============================================
+DraughtingModelItemAssociation StepAP242
+GeometricItemSpecificUsage StepAP242
+IdAttribute StepAP242
+IdAttributeSelect StepAP242
+ItemIdentifiedRepresentationUsage StepAP242
+ItemIdentifiedRepresentationUsageDefinition StepAP242
+
+#===============================================
+# package StepBasic
+#===============================================
+Action StepBasic
+ActionAssignment StepBasic
+ActionMethod StepBasic
+ActionRequestAssignment StepBasic
+ActionRequestSolution StepBasic
+Address StepBasic
+ApplicationContext StepBasic
+ApplicationContextElement StepBasic
+ApplicationProtocolDefinition StepBasic
+Approval StepBasic
+ApprovalAssignment StepBasic
+ApprovalDateTime StepBasic
+ApprovalPersonOrganization StepBasic
+ApprovalRelationship StepBasic
+ApprovalRole StepBasic
+ApprovalStatus StepBasic
+AreaUnit StepBasic
+CalendarDate StepBasic
+Certification StepBasic
+CertificationAssignment StepBasic
+CertificationType StepBasic
+CharacterizedObject StepBasic
+Contract StepBasic
+ContractAssignment StepBasic
+ContractType StepBasic
+ConversionBasedUnit StepBasic
+ConversionBasedUnitAndAreaUnit StepBasic
+ConversionBasedUnitAndLengthUnit StepBasic
+ConversionBasedUnitAndMassUnit StepBasic
+ConversionBasedUnitAndPlaneAngleUnit StepBasic
+ConversionBasedUnitAndRatioUnit StepBasic
+ConversionBasedUnitAndSolidAngleUnit StepBasic
+ConversionBasedUnitAndTimeUnit StepBasic
+ConversionBasedUnitAndVolumeUnit StepBasic
+CoordinatedUniversalTimeOffset StepBasic
+Date StepBasic
+DateAndTime StepBasic
+DateAndTimeAssignment StepBasic
+DateAssignment StepBasic
+DateRole StepBasic
+DateTimeRole StepBasic
+DateTimeSelect StepBasic
+DerivedUnit StepBasic
+DerivedUnitElement StepBasic
+DesignContext StepBasic
+DigitalDocument StepBasic
+DimensionalExponents StepBasic
+Document StepBasic
+DocumentFile StepBasic
+DocumentProductAssociation StepBasic
+DocumentProductEquivalence StepBasic
+DocumentReference StepBasic
+DocumentRelationship StepBasic
+DocumentRepresentationType StepBasic
+DocumentType StepBasic
+DocumentUsageConstraint StepBasic
+Effectivity StepBasic
+EffectivityAssignment StepBasic
+EulerAngles StepBasic
+ExternalIdentificationAssignment StepBasic
+ExternallyDefinedItem StepBasic
+ExternalSource StepBasic
+GeneralProperty StepBasic
+Group StepBasic
+GroupAssignment StepBasic
+GroupRelationship StepBasic
+IdentificationAssignment StepBasic
+IdentificationRole StepBasic
+LengthMeasureWithUnit StepBasic
+LengthUnit StepBasic
+LocalTime StepBasic
+MassMeasureWithUnit StepBasic
+MassUnit StepBasic
+MeasureValueMember StepBasic
+MeasureWithUnit StepBasic
+MechanicalContext StepBasic
+NameAssignment StepBasic
+NamedUnit StepBasic
+ObjectRole StepBasic
+OrdinalDate StepBasic
+Organization StepBasic
+OrganizationalAddress StepBasic
+OrganizationAssignment StepBasic
+OrganizationRole StepBasic
+Person StepBasic
+PersonalAddress StepBasic
+PersonAndOrganization StepBasic
+PersonAndOrganizationAssignment StepBasic
+PersonAndOrganizationRole StepBasic
+PersonOrganizationSelect StepBasic
+PhysicallyModeledProductDefinition StepBasic
+PlaneAngleMeasureWithUnit StepBasic
+PlaneAngleUnit StepBasic
+Product StepBasic
+ProductCategory StepBasic
+ProductCategoryRelationship StepBasic
+ProductConceptContext StepBasic
+ProductContext StepBasic
+ProductDefinition StepBasic
+ProductDefinitionContext StepBasic
+ProductDefinitionEffectivity StepBasic
+ProductDefinitionFormation StepBasic
+ProductDefinitionFormationRelationship StepBasic
+ProductDefinitionFormationWithSpecifiedSource StepBasic
+ProductDefinitionOrReference StepBasic
+ProductDefinitionReference StepBasic
+ProductDefinitionReferenceWithLocalRepresentation StepBasic
+ProductDefinitionRelationship StepBasic
+ProductDefinitionWithAssociatedDocuments StepBasic
+ProductOrFormationOrDefinition StepBasic
+ProductRelatedProductCategory StepBasic
+ProductType StepBasic
+RatioMeasureWithUnit StepBasic
+RatioUnit StepBasic
+RoleAssociation StepBasic
+RoleSelect StepBasic
+SecurityClassification StepBasic
+SecurityClassificationAssignment StepBasic
+SecurityClassificationLevel StepBasic
+SiUnit StepBasic
+SiUnitAndAreaUnit StepBasic
+SiUnitAndLengthUnit StepBasic
+SiUnitAndMassUnit StepBasic
+SiUnitAndPlaneAngleUnit StepBasic
+SiUnitAndRatioUnit StepBasic
+SiUnitAndSolidAngleUnit StepBasic
+SiUnitAndThermodynamicTemperatureUnit StepBasic
+SiUnitAndTimeUnit StepBasic
+SiUnitAndVolumeUnit StepBasic
+SizeMember StepBasic
+SizeSelect StepBasic
+SolidAngleMeasureWithUnit StepBasic
+SolidAngleUnit StepBasic
+SourceItem StepBasic
+ThermodynamicTemperatureUnit StepBasic
+TimeMeasureWithUnit StepBasic
+TimeUnit StepBasic
+UncertaintyMeasureWithUnit StepBasic
+Unit StepBasic
+VersionedActionRequest StepBasic
+VolumeUnit StepBasic
+WeekOfYearAndDayDate StepBasic
+
+#===============================================
+# package StepDimTol
+#===============================================
+AngularityTolerance StepDimTol
+CircularRunoutTolerance StepDimTol
+CoaxialityTolerance StepDimTol
+CommonDatum StepDimTol
+ConcentricityTolerance StepDimTol
+CylindricityTolerance StepDimTol
+Datum StepDimTol
+DatumFeature StepDimTol
+DatumOrCommonDatum StepDimTol
+DatumReference StepDimTol
+DatumReferenceCompartment StepDimTol
+DatumReferenceElement StepDimTol
+DatumReferenceModifier StepDimTol
+DatumReferenceModifierWithValue StepDimTol
+DatumSystem StepDimTol
+DatumSystemOrReference StepDimTol
+DatumTarget StepDimTol
+FlatnessTolerance StepDimTol
+GeneralDatumReference StepDimTol
+GeometricTolerance StepDimTol
+GeometricToleranceRelationship StepDimTol
+GeometricToleranceTarget StepDimTol
+GeometricToleranceWithDatumReference StepDimTol
+GeometricToleranceWithDefinedAreaUnit StepDimTol
+GeometricToleranceWithDefinedUnit StepDimTol
+GeometricToleranceWithMaximumTolerance StepDimTol
+GeometricToleranceWithModifiers StepDimTol
+GeoTolAndGeoTolWthDatRef StepDimTol
+GeoTolAndGeoTolWthDatRefAndGeoTolWthMaxTol StepDimTol
+GeoTolAndGeoTolWthDatRefAndGeoTolWthMod StepDimTol
+GeoTolAndGeoTolWthDatRefAndModGeoTolAndPosTol StepDimTol
+GeoTolAndGeoTolWthDatRefAndUneqDisGeoTol StepDimTol
+GeoTolAndGeoTolWthMaxTol StepDimTol
+GeoTolAndGeoTolWthMod StepDimTol
+LineProfileTolerance StepDimTol
+ModifiedGeometricTolerance StepDimTol
+NonUniformZoneDefinition StepDimTol
+ParallelismTolerance StepDimTol
+PerpendicularityTolerance StepDimTol
+PlacedDatumTargetFeature StepDimTol
+PositionTolerance StepDimTol
+ProjectedZoneDefinition StepDimTol
+RoundnessTolerance StepDimTol
+RunoutZoneDefinition StepDimTol
+RunoutZoneOrientation StepDimTol
+ShapeToleranceSelect StepDimTol
+SimpleDatumReferenceModifierMember StepDimTol
+StraightnessTolerance StepDimTol
+SurfaceProfileTolerance StepDimTol
+SymmetryTolerance StepDimTol
+ToleranceZone StepDimTol
+ToleranceZoneDefinition StepDimTol
+ToleranceZoneForm StepDimTol
+ToleranceZoneTarget StepDimTol
+TotalRunoutTolerance StepDimTol
+UnequallyDisposedGeometricTolerance StepDimTol
+
+#===============================================
+# package StepElement
+#===============================================
+AnalysisItemWithinRepresentation StepElement
+Curve3dElementDescriptor StepElement
+CurveElementEndReleasePacket StepElement
+CurveElementFreedom StepElement
+CurveElementFreedomMember StepElement
+CurveElementPurpose StepElement
+CurveElementPurposeMember StepElement
+CurveElementSectionDefinition StepElement
+CurveElementSectionDerivedDefinitions StepElement
+ElementAspect StepElement
+ElementAspectMember StepElement
+ElementDescriptor StepElement
+ElementMaterial StepElement
+MeasureOrUnspecifiedValue StepElement
+MeasureOrUnspecifiedValueMember StepElement
+Surface3dElementDescriptor StepElement
+SurfaceElementProperty StepElement
+SurfaceElementPurpose StepElement
+SurfaceElementPurposeMember StepElement
+SurfaceSection StepElement
+SurfaceSectionField StepElement
+SurfaceSectionFieldConstant StepElement
+SurfaceSectionFieldVarying StepElement
+UniformSurfaceSection StepElement
+Volume3dElementDescriptor StepElement
+VolumeElementPurpose StepElement
+VolumeElementPurposeMember StepElement
+
+#===============================================
+# package StepFEA
+#===============================================
+AlignedCurve3dElementCoordinateSystem StepFEA
+AlignedSurface3dElementCoordinateSystem StepFEA
+ArbitraryVolume3dElementCoordinateSystem StepFEA
+ConstantSurface3dElementCoordinateSystem StepFEA
+Curve3dElementProperty StepFEA
+Curve3dElementRepresentation StepFEA
+CurveElementEndCoordinateSystem StepFEA
+CurveElementEndOffset StepFEA
+CurveElementEndRelease StepFEA
+CurveElementInterval StepFEA
+CurveElementIntervalConstant StepFEA
+CurveElementIntervalLinearlyVarying StepFEA
+CurveElementLocation StepFEA
+DegreeOfFreedom StepFEA
+DegreeOfFreedomMember StepFEA
+DummyNode StepFEA
+ElementGeometricRelationship StepFEA
+ElementGroup StepFEA
+ElementOrElementGroup StepFEA
+ElementRepresentation StepFEA
+FeaAreaDensity StepFEA
+FeaAxis2Placement3d StepFEA
+FeaCurveSectionGeometricRelationship StepFEA
+FeaGroup StepFEA
+FeaLinearElasticity StepFEA
+FeaMassDensity StepFEA
+FeaMaterialPropertyRepresentation StepFEA
+FeaMaterialPropertyRepresentationItem StepFEA
+FeaModel StepFEA
+FeaModel3d StepFEA
+FeaModelDefinition StepFEA
+FeaMoistureAbsorption StepFEA
+FeaParametricPoint StepFEA
+FeaRepresentationItem StepFEA
+FeaSecantCoefficientOfLinearThermalExpansion StepFEA
+FeaShellBendingStiffness StepFEA
+FeaShellMembraneBendingCouplingStiffness StepFEA
+FeaShellMembraneStiffness StepFEA
+FeaShellShearStiffness StepFEA
+FeaSurfaceSectionGeometricRelationship StepFEA
+FeaTangentialCoefficientOfLinearThermalExpansion StepFEA
+FreedomAndCoefficient StepFEA
+FreedomsList StepFEA
+GeometricNode StepFEA
+Node StepFEA
+NodeDefinition StepFEA
+NodeGroup StepFEA
+NodeRepresentation StepFEA
+NodeSet StepFEA
+NodeWithSolutionCoordinateSystem StepFEA
+NodeWithVector StepFEA
+ParametricCurve3dElementCoordinateDirection StepFEA
+ParametricCurve3dElementCoordinateSystem StepFEA
+ParametricSurface3dElementCoordinateSystem StepFEA
+Surface3dElementRepresentation StepFEA
+SymmetricTensor22d StepFEA
+SymmetricTensor23d StepFEA
+SymmetricTensor23dMember StepFEA
+SymmetricTensor42d StepFEA
+SymmetricTensor43d StepFEA
+SymmetricTensor43dMember StepFEA
+Volume3dElementRepresentation StepFEA
+
+#===============================================
+# package StepGeom
+#===============================================
+Axis1Placement StepGeom
+Axis2Placement StepGeom
+Axis2Placement2d StepGeom
+Axis2Placement3d StepGeom
+BezierCurve StepGeom
+BezierCurveAndRationalBSplineCurve StepGeom
+BezierSurface StepGeom
+BezierSurfaceAndRationalBSplineSurface StepGeom
+BoundaryCurve StepGeom
+BoundedCurve StepGeom
+BoundedSurface StepGeom
+BSplineCurve StepGeom
+BSplineCurveWithKnots StepGeom
+BSplineCurveWithKnotsAndRationalBSplineCurve StepGeom
+BSplineSurface StepGeom
+BSplineSurfaceWithKnots StepGeom
+BSplineSurfaceWithKnotsAndRationalBSplineSurface StepGeom
+CartesianPoint StepGeom
+CartesianTransformationOperator StepGeom
+CartesianTransformationOperator2d StepGeom
+CartesianTransformationOperator3d StepGeom
+Circle StepGeom
+CompositeCurve StepGeom
+CompositeCurveOnSurface StepGeom
+CompositeCurveSegment StepGeom
+Conic StepGeom
+ConicalSurface StepGeom
+Curve StepGeom
+CurveBoundedSurface StepGeom
+CurveOnSurface StepGeom
+CurveReplica StepGeom
+CylindricalSurface StepGeom
+DegeneratePcurve StepGeom
+DegenerateToroidalSurface StepGeom
+Direction StepGeom
+ElementarySurface StepGeom
+Ellipse StepGeom
+EvaluatedDegeneratePcurve StepGeom
+GeometricRepresentationContext StepGeom
+GeometricRepresentationContextAndGlobalUnitAssignedContext StepGeom
+GeometricRepresentationContextAndParametricRepresentationContext StepGeom
+GeometricRepresentationItem StepGeom
+GeomRepContextAndGlobUnitAssCtxAndGlobUncertaintyAssCtx StepGeom
+Hyperbola StepGeom
+IntersectionCurve StepGeom
+Line StepGeom
+OffsetCurve3d StepGeom
+OffsetSurface StepGeom
+OrientedSurface StepGeom
+OuterBoundaryCurve StepGeom
+Parabola StepGeom
+Pcurve StepGeom
+PcurveOrSurface StepGeom
+Placement StepGeom
+Plane StepGeom
+Point StepGeom
+PointOnCurve StepGeom
+PointOnSurface StepGeom
+PointReplica StepGeom
+Polyline StepGeom
+QuasiUniformCurve StepGeom
+QuasiUniformCurveAndRationalBSplineCurve StepGeom
+QuasiUniformSurface StepGeom
+QuasiUniformSurfaceAndRationalBSplineSurface StepGeom
+RationalBSplineCurve StepGeom
+RationalBSplineSurface StepGeom
+RectangularCompositeSurface StepGeom
+RectangularTrimmedSurface StepGeom
+ReparametrisedCompositeCurveSegment StepGeom
+SeamCurve StepGeom
+SphericalSurface StepGeom
+Surface StepGeom
+SurfaceBoundary StepGeom
+SurfaceCurveAndBoundedCurve StepGeom
+SurfaceOfLinearExtrusion StepGeom
+SurfaceOfRevolution StepGeom
+SurfacePatch StepGeom
+SurfaceReplica StepGeom
+SweptSurface StepGeom
+ToroidalSurface StepGeom
+TrimmedCurve StepGeom
+TrimmingMember StepGeom
+TrimmingSelect StepGeom
+UniformCurve StepGeom
+UniformCurveAndRationalBSplineCurve StepGeom
+UniformSurface StepGeom
+UniformSurfaceAndRationalBSplineSurface StepGeom
+Vector StepGeom
+VectorOrDirection StepGeom
+
+#===============================================
+# package StepRepr
+#===============================================
+AllAroundShapeAspect StepRepr
+Apex StepRepr
+AssemblyComponentUsage StepRepr
+AssemblyComponentUsageSubstitute StepRepr
+BetweenShapeAspect StepRepr
+CentreOfSymmetry StepRepr
+CharacterizedDefinition StepRepr
+CharacterizedRepresentation StepRepr
+CompGroupShAspAndCompShAspAndDatumFeatAndShAsp StepRepr
+CompositeGroupShapeAspect StepRepr
+CompositeShapeAspect StepRepr
+CompoundRepresentationItem StepRepr
+CompShAspAndDatumFeatAndShAsp StepRepr
+ConfigurationDesign StepRepr
+ConfigurationDesignItem StepRepr
+ConfigurationEffectivity StepRepr
+ConfigurationItem StepRepr
+ConstructiveGeometryRepresentation StepRepr
+ConstructiveGeometryRepresentationRelationship StepRepr
+ContinuosShapeAspect StepRepr
+DataEnvironment StepRepr
+DefinitionalRepresentation StepRepr
+DerivedShapeAspect StepRepr
+DescriptiveRepresentationItem StepRepr
+Extension StepRepr
+ExternallyDefinedRepresentation StepRepr
+FeatureForDatumTargetRelationship StepRepr
+FunctionallyDefinedTransformation StepRepr
+GeometricAlignment StepRepr
+GlobalUncertaintyAssignedContext StepRepr
+GlobalUnitAssignedContext StepRepr
+IntegerRepresentationItem StepRepr
+ItemDefinedTransformation StepRepr
+MakeFromUsageOption StepRepr
+MappedItem StepRepr
+MaterialDesignation StepRepr
+MaterialProperty StepRepr
+MaterialPropertyRepresentation StepRepr
+MeasureRepresentationItem StepRepr
+NextAssemblyUsageOccurrence StepRepr
+ParallelOffset StepRepr
+ParametricRepresentationContext StepRepr
+PerpendicularTo StepRepr
+ProductConcept StepRepr
+ProductDefinitionShape StepRepr
+ProductDefinitionUsage StepRepr
+PromissoryUsageOccurrence StepRepr
+PropertyDefinition StepRepr
+PropertyDefinitionRelationship StepRepr
+PropertyDefinitionRepresentation StepRepr
+QuantifiedAssemblyComponentUsage StepRepr
+Representation StepRepr
+RepresentationContext StepRepr
+RepresentationItem StepRepr
+RepresentationMap StepRepr
+RepresentationRelationship StepRepr
+RepresentationRelationshipWithTransformation StepRepr
+RepresentedDefinition StepRepr
+ReprItemAndLengthMeasureWithUnit StepRepr
+ReprItemAndLengthMeasureWithUnitAndQRI StepRepr
+ReprItemAndMeasureWithUnit StepRepr
+ReprItemAndMeasureWithUnitAndQRI StepRepr
+ReprItemAndPlaneAngleMeasureWithUnit StepRepr
+ReprItemAndPlaneAngleMeasureWithUnitAndQRI StepRepr
+ShapeAspect StepRepr
+ShapeAspectDerivingRelationship StepRepr
+ShapeAspectRelationship StepRepr
+ShapeAspectTransition StepRepr
+ShapeDefinition StepRepr
+ShapeRepresentationRelationship StepRepr
+ShapeRepresentationRelationshipWithTransformation StepRepr
+SpecifiedHigherUsageOccurrence StepRepr
+StructuralResponseProperty StepRepr
+StructuralResponsePropertyDefinitionRepresentation StepRepr
+SuppliedPartRelationship StepRepr
+Tangent StepRepr
+Transformation StepRepr
+ValueRange StepRepr
+ValueRepresentationItem StepRepr
+
+#===============================================
+# package StepShape
+#===============================================
+AdvancedBrepShapeRepresentation StepShape
+AdvancedFace StepShape
+AngularLocation StepShape
+AngularSize StepShape
+Block StepShape
+BooleanOperand StepShape
+BooleanResult StepShape
+BoxDomain StepShape
+BoxedHalfSpace StepShape
+BrepWithVoids StepShape
+ClosedShell StepShape
+CompoundShapeRepresentation StepShape
+ConnectedEdgeSet StepShape
+ConnectedFaceSet StepShape
+ConnectedFaceShapeRepresentation StepShape
+ConnectedFaceSubSet StepShape
+ContextDependentShapeRepresentation StepShape
+CsgPrimitive StepShape
+CsgSelect StepShape
+CsgShapeRepresentation StepShape
+CsgSolid StepShape
+DefinitionalRepresentationAndShapeRepresentation StepShape
+DimensionalCharacteristic StepShape
+DimensionalCharacteristicRepresentation StepShape
+DimensionalLocation StepShape
+DimensionalLocationWithPath StepShape
+DimensionalSize StepShape
+DimensionalSizeWithPath StepShape
+DirectedDimensionalLocation StepShape
+Edge StepShape
+EdgeBasedWireframeModel StepShape
+EdgeBasedWireframeShapeRepresentation StepShape
+EdgeCurve StepShape
+EdgeLoop StepShape
+ExtrudedAreaSolid StepShape
+ExtrudedFaceSolid StepShape
+Face StepShape
+FaceBasedSurfaceModel StepShape
+FaceBound StepShape
+FaceOuterBound StepShape
+FaceSurface StepShape
+FacetedBrep StepShape
+FacetedBrepAndBrepWithVoids StepShape
+FacetedBrepShapeRepresentation StepShape
+GeometricallyBoundedSurfaceShapeRepresentation StepShape
+GeometricallyBoundedWireframeShapeRepresentation StepShape
+GeometricCurveSet StepShape
+GeometricSet StepShape
+GeometricSetSelect StepShape
+HalfSpaceSolid StepShape
+LimitsAndFits StepShape
+Loop StepShape
+LoopAndPath StepShape
+ManifoldSolidBrep StepShape
+ManifoldSurfaceShapeRepresentation StepShape
+MeasureQualification StepShape
+MeasureRepresentationItemAndQualifiedRepresentationItem StepShape
+NonManifoldSurfaceShapeRepresentation StepShape
+OpenShell StepShape
+OrientedClosedShell StepShape
+OrientedEdge StepShape
+OrientedFace StepShape
+OrientedOpenShell StepShape
+OrientedPath StepShape
+Path StepShape
+PlusMinusTolerance StepShape
+PointRepresentation StepShape
+PolyLoop StepShape
+PrecisionQualifier StepShape
+QualifiedRepresentationItem StepShape
+ReversibleTopologyItem StepShape
+RevolvedAreaSolid StepShape
+RevolvedFaceSolid StepShape
+RightAngularWedge StepShape
+RightCircularCone StepShape
+RightCircularCylinder StepShape
+SeamEdge StepShape
+ShapeDefinitionRepresentation StepShape
+ShapeDimensionRepresentation StepShape
+ShapeDimensionRepresentationItem StepShape
+ShapeRepresentation StepShape
+ShapeRepresentationWithParameters StepShape
+Shell StepShape
+ShellBasedSurfaceModel StepShape
+SolidModel StepShape
+SolidReplica StepShape
+Sphere StepShape
+Subedge StepShape
+Subface StepShape
+SurfaceModel StepShape
+SweptAreaSolid StepShape
+SweptFaceSolid StepShape
+ToleranceMethodDefinition StepShape
+ToleranceValue StepShape
+TopologicalRepresentationItem StepShape
+Torus StepShape
+TransitionalShapeRepresentation StepShape
+TypeQualifier StepShape
+ValueFormatTypeQualifier StepShape
+ValueQualifier StepShape
+Vertex StepShape
+VertexLoop StepShape
+VertexPoint StepShape
+
+#===============================================
+# package StepVisual
+#===============================================
+AnnotationCurveOccurrence StepVisual
+AnnotationCurveOccurrenceAndAnnotationOccurrenceAndGeomReprItemAndReprItemAndStyledItem StepVisual
+AnnotationFillArea StepVisual
+AnnotationFillAreaOccurrence StepVisual
+AnnotationOccurrence StepVisual
+AnnotationPlane StepVisual
+AnnotationPlaneElement StepVisual
+AnnotationText StepVisual
+AnnotationTextOccurrence StepVisual
+AreaInSet StepVisual
+AreaOrView StepVisual
+BackgroundColour StepVisual
+BoxCharacteristicSelect StepVisual
+CameraImage StepVisual
+CameraImage2dWithScale StepVisual
+CameraImage3dWithScale StepVisual
+CameraModel StepVisual
+CameraModelD2 StepVisual
+CameraModelD3 StepVisual
+CameraModelD3MultiClipping StepVisual
+CameraModelD3MultiClippingInterectionSelect StepVisual
+CameraModelD3MultiClippingIntersection StepVisual
+CameraModelD3MultiClippingUnion StepVisual
+CameraModelD3MultiClippingUnionSelect StepVisual
+CameraUsage StepVisual
+CharacterizedObjectAndCharacterizedRepresentationAndDraughtingModelAndRepresentation StepVisual
+Colour StepVisual
+ColourRgb StepVisual
+ColourSpecification StepVisual
+CompositeText StepVisual
+CompositeTextWithExtent StepVisual
+ContextDependentInvisibility StepVisual
+ContextDependentOverRidingStyledItem StepVisual
+CurveStyle StepVisual
+CurveStyleFont StepVisual
+CurveStyleFontPattern StepVisual
+CurveStyleFontSelect StepVisual
+DirectionCountSelect StepVisual
+DraughtingAnnotationOccurrence StepVisual
+DraughtingCallout StepVisual
+DraughtingCalloutElement StepVisual
+DraughtingModel StepVisual
+DraughtingPreDefinedColour StepVisual
+DraughtingPreDefinedCurveFont StepVisual
+ExternallyDefinedCurveFont StepVisual
+ExternallyDefinedTextFont StepVisual
+FillAreaStyle StepVisual
+FillAreaStyleColour StepVisual
+FillStyleSelect StepVisual
+FontSelect StepVisual
+Invisibility StepVisual
+InvisibilityContext StepVisual
+InvisibleItem StepVisual
+LayeredItem StepVisual
+MarkerMember StepVisual
+MarkerSelect StepVisual
+MechanicalDesignGeometricPresentationArea StepVisual
+MechanicalDesignGeometricPresentationRepresentation StepVisual
+NullStyleMember StepVisual
+OverRidingStyledItem StepVisual
+PlanarBox StepVisual
+PlanarExtent StepVisual
+PointStyle StepVisual
+PreDefinedColour StepVisual
+PreDefinedCurveFont StepVisual
+PreDefinedItem StepVisual
+PreDefinedTextFont StepVisual
+PresentationArea StepVisual
+PresentationLayerAssignment StepVisual
+PresentationLayerUsage StepVisual
+PresentationRepresentation StepVisual
+PresentationRepresentationSelect StepVisual
+PresentationSet StepVisual
+PresentationSize StepVisual
+PresentationSizeAssignmentSelect StepVisual
+PresentationStyleAssignment StepVisual
+PresentationStyleByContext StepVisual
+PresentationStyleSelect StepVisual
+PresentationView StepVisual
+PresentedItem StepVisual
+PresentedItemRepresentation StepVisual
+StyleContextSelect StepVisual
+StyledItem StepVisual
+StyledItemTarget StepVisual
+SurfaceSideStyle StepVisual
+SurfaceStyleBoundary StepVisual
+SurfaceStyleControlGrid StepVisual
+SurfaceStyleElementSelect StepVisual
+SurfaceStyleFillArea StepVisual
+SurfaceStyleParameterLine StepVisual
+SurfaceStyleSegmentationCurve StepVisual
+SurfaceStyleSilhouette StepVisual
+SurfaceStyleUsage StepVisual
+Template StepVisual
+TemplateInstance StepVisual
+TextLiteral StepVisual
+TextOrCharacter StepVisual
+TextStyle StepVisual
+TextStyleForDefinedFont StepVisual
+TextStyleWithBoxCharacteristics StepVisual
+ViewVolume StepVisual
+TessellatedAnnotationOccurrence StepVisual
+TessellatedItem StepVisual
+TessellatedGeometricSet StepVisual
+TessellatedCurveSet StepVisual
+CoordinatesList StepVisual
+SurfaceStyleTransparent StepVisual
+SurfaceStyleReflectanceAmbient StepVisual
+SurfaceStyleRendering StepVisual
+SurfaceStyleRenderingWithProperties StepVisual
--- /dev/null
+This is an auxiliary tool to generate code for implementation of new STEP entities into OCCT.
+
+This tool contains from two packages: ExpToCasExe and Express(+TKExpress)
+
+Package Express contains classes for all needed items from STEP schema.
+
+Package ExpToCasExe is a base package for generation;
+This packages includes following files:
+ exptocas.lex
+ exptocas.yacc
+ exptocas.tab.cxx
+ exptocas.tab.hxx
+ ExpToCasExe.cxx
+ EXTERNLIB
+ FILES
+ FlexLexer.h
+ lex.exptocas.cxx
+ occt_existed_step_entities.lst
+
+Files exptocas.lex, exptocas.yacc and ExpToCasExe.cxx are a base files for generator.
+Files exptocas.tab.cxx, exptocas.tab.hxx, lex.exptocas.cxx and FlexLexer.h are a result
+of generation from files exptocas.lex and exptocas.yac.
+Result of building will be executable file ExpToCasExe.exe.
+
+WARNING: It is not recommended to modify files exptocas.tab.cxx, exptocas.tab.hxx, lex.exptocas.cxx
+and FlexLexer.h manually.
+
+!!!NOTE: It is strongly prohibited to commit manually changed files exptocas.tab.cxx, exptocas.tab.hxx,
+lex.exptocas.cxx and FlexLexer.h.
+
+File occt_existed_step_entities.lst contains list of STEP entities implemented in OCC at this moment.
+
+
+Example how to run ExpToCas tool:
+
+ ExpToCasExe.exe schema.exp new_entities.lst occt_existed_step_entities.lst N
+
+where
+ * schema.exp - STEP schema
+ * new_entities.lst - list of entities which we have to generate,
+ each line should be like this "ClassName PackageName"
+ (see example in the file occt_existed_step_entities.lst).
+ * occt_existed_step_entities.lst - list of already implemented STEP entities
+ * N - a first index for entity registration
+ (value of it you can recieve after analyse of files StepAP214_Protocol.cxx,
+ RWStepAP214_GeneralModule.cxx, RWStepAP214_ReadWriteModule.cxx)
+
+!!!NOTE: It is strongly recommended to update file occt_existed_step_entities.lst
+ after each generation and not to forget to change date of updation in the
+ first line of this file.
+
+The result of generation consists of several folders:
+ * two folders ("PackageName" and "RWPackageName") for each package for which new entities was generated.
+ * a folder "Registration" with *.txt files with code to copy into common files (see description of last parameter).
+
+
+For generation it is easy to copy to separate directory following files:
+ - ExpToCasExe.exe, TKernel.dll, TKExpress.dll, tbb.dll and tbbmalloc.dll from OCC
+ - STEP schema (schema.exp)
+ - occt_existed_step_entities.lst from package occt/src/ExpToCasExe
+ - file with needed entities new_entities.lst
+and from this directoty execute command:
+ ExpToCasExe.exe schema.exp new_entities.lst occt_existed_step_entities.lst N
+
+NOTE:
+Some of STEP schemes may be not fully corresponded to rules which set in our generator.
+If during generation we recieve a message about syntaxis error you can try to edit schema
+file in order to avoid it. Such approach is reasonable if number of errors is small.
+If there are many errors we have to change existed rules (for debug parser process you can
+uncomment string "//aScanner.set_debug(1);" in the file exptocas.yacc).
+
+NOTE:
+Please, take into account that most of existed entities was generated many years ago.
+Some of them can be not corresonded to last versions of schemes.
+For example we haven`t classes for entity:
+ ENTITY founded_item
+ SUPERTYPE OF ((ONEOF(b_spline_curve_knot_locator, b_spline_curve_segment, b_spline_surface_knot_locator,
+ b_spline_surface_patch, b_spline_surface_strip,
+ boundary_curve_of_b_spline_or_rectangular_composite_surface, box_domain,
+ character_glyph_style_outline, character_glyph_style_stroke, composite_curve_segment,
+ composite_curve_transition_locator, curve_style, curve_style_font, curve_style_font_and_scaling,
+ curve_style_font_pattern, externally_defined_style, fill_area_style,
+ interpolated_configuration_segment, kinematic_path_segment, plane_angle_and_length_pair,
+ plane_angle_and_ratio_pair, point_style, presentation_style_assignment,
+ rectangular_composite_surface_transition_locator, surface_patch, surface_side_style,
+ surface_style_boundary, surface_style_control_grid, surface_style_fill_area,
+ surface_style_parameter_line, surface_style_segmentation_curve, surface_style_silhouette,
+ surface_style_usage, symbol_style, text_style, view_volume)) ANDOR
+ (ONEOF(character_glyph_style_outline, character_glyph_style_stroke, curve_style, curve_style_font,
+ curve_style_font_and_scaling, curve_style_font_pattern, externally_defined_style,
+ fill_area_style, point_style, presentation_style_assignment, surface_side_style,
+ surface_style_boundary, surface_style_control_grid, surface_style_fill_area,
+ surface_style_parameter_line, surface_style_segmentation_curve, surface_style_silhouette,
+ surface_style_usage, symbol_style, text_style)));
+ DERIVE
+ users : SET [0 : ?] OF founded_item_select := using_items(SELF, []);
+ WHERE
+ WR1: SIZEOF(users) > 0;
+ WR2: NOT (SELF IN users);
+ END_ENTITY;
+But some of existed entities (for example - composite_curve_segment) must be inherited from
+this missing entity (at present such existed entities are inherited from Standard_Transient):
+ ENTITY composite_curve_segment
+ SUBTYPE OF (founded_item);
+ transition : transition_code;
+ same_sense : BOOLEAN;
+ parent_curve : curve;
+ INVERSE
+ using_curves : BAG[1:?] OF composite_curve FOR segments;
+ WHERE
+ wr1 : ('AUTOMOTIVE_DESIGN.BOUNDED_CURVE' IN TYPEOF(parent_curve));
+ END_ENTITY; -- 10303-42: geometry_schema
+
+
+
+
--- /dev/null
+// 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 HXX or CXX file
+//=======================================================================
+
+void Express::WriteFileStamp(Standard_OStream &theOS)
+{
+ static const char* EC_VERSION = "2.0";
+
+ Standard_CString comm = "//";
+ TCollection_AsciiString timestring;
+ if (getenv("EXPTOCAS_TIME"))
+ {
+ timestring = getenv("EXPTOCAS_TIME");
+ }
+ else
+ {
+ time_t curtime;
+ time ( &curtime );
+ timestring = ctime ( &curtime );
+ timestring.ChangeAll ( '\n', ' ' );
+ }
+ theOS << comm << " Created on : " << timestring << std::endl;
+
+ OSD_Process aProcess;
+ theOS << comm << " Created by: " << aProcess.UserName().ToCString() << std::endl;
+ theOS << comm << " Generator: Express (EXPRESS -> CASCADE/XSTEP Translator) V" << EC_VERSION << std::endl;
+ theOS << comm << " Copyright (c) Open CASCADE 2020" << std::endl;
+ theOS << comm << std::endl;
+ theOS << comm << " This file is part of Open CASCADE Technology software library." << std::endl;
+ theOS << comm << std::endl;
+ theOS << comm << " This library is free software; you can redistribute it and/or modify it under" << std::endl;
+ theOS << comm << " the terms of the GNU Lesser General Public License version 2.1 as published" << std::endl;
+ theOS << comm << " by the Free Software Foundation, with special exception defined in the file" << std::endl;
+ theOS << comm << " OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT" << std::endl;
+ theOS << comm << " distribution for complete text of the license and disclaimer of any warranty." << std::endl;
+ theOS << comm << std::endl;
+ theOS << comm << " Alternatively, this file may be used under the terms of Open CASCADE" << std::endl;
+ theOS << comm << " commercial license or contractual agreement." << std::endl;
+ theOS << std::endl;
+}
+
+//=======================================================================
+//function : WriteMethodStamp
+//purpose :
+//=======================================================================
+
+void Express::WriteMethodStamp(Standard_OStream &theOS, const Handle(TCollection_HAsciiString) &theName)
+{
+ theOS << std::endl;
+ theOS << "//=======================================================================" << std::endl;
+ theOS << "//function : " << theName->ToCString() << std::endl;
+ theOS << "//purpose : " << std::endl;
+ theOS << "//=======================================================================" << std::endl;
+ theOS << std::endl;
+}
+
+//=======================================================================
+//function : ToStepName
+//purpose :
+//=======================================================================
+
+Handle(TCollection_HAsciiString) Express::ToStepName(const Handle(TCollection_HAsciiString) &theName)
+{
+ Handle(TCollection_HAsciiString) stepname = new TCollection_HAsciiString(theName);
+ 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) &theName)
+{
+ Handle(TCollection_HAsciiString) stepname = new TCollection_HAsciiString;
+ for (Standard_Integer i = 1; i <= theName->Length(); i++)
+ {
+ if (isupper(theName->Value(i)))
+ {
+ stepname->AssignCat(new TCollection_HAsciiString(theName->Value(i)));
+ }
+ }
+ stepname->LowerCase();
+ return stepname;
+}
+
--- /dev/null
+// 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 (HXX 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.)
+ Standard_EXPORT static void WriteFileStamp (Standard_OStream& theOS);
+
+ //! Writes standard comment for method in CXX file
+ Standard_EXPORT static void WriteMethodStamp (Standard_OStream& theOS,
+ const Handle(TCollection_HAsciiString)& theName);
+
+ //! Converts item name from CASCADE to STEP style
+ //! e.g. BoundedCurve -> bounded_curve
+ Standard_EXPORT static Handle(TCollection_HAsciiString) ToStepName (const Handle(TCollection_HAsciiString)& theName);
+
+ //! Converts item name from CASCADE to STEP style
+ //! e.g. BoundedCurve -> bounded_curve
+ Standard_EXPORT static Handle(TCollection_HAsciiString) EnumPrefix (const Handle(TCollection_HAsciiString)& theName);
+};
+
+#endif // _Express_HeaderFile
--- /dev/null
+// 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 theName, const Handle(Express_Type) &theType)
+ : Express_Item(theName), myType(theType)
+{
+}
+
+//=======================================================================
+//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 : 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()->CPPName()->ToCString()
+ << " used; no generation is needed" << std::endl;
+ return Standard_False;
+}
--- /dev/null
+// 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 theName, const Handle(Express_Type)& theType);
+
+ //! Returns aliased type
+ Standard_EXPORT const Handle(Express_Type)& Type() const;
+
+ //! Returns name of aliased type
+ Standard_EXPORT virtual Handle(TCollection_HAsciiString) CPPName() const Standard_OVERRIDE;
+
+ //! Create HXX/CXX files from item
+ Standard_EXPORT virtual Standard_Boolean GenerateClass() const Standard_OVERRIDE;
+
+ DEFINE_STANDARD_RTTIEXT(Express_Alias,Express_Item)
+
+protected:
+
+
+private:
+
+ Handle(Express_Type) myType;
+
+};
+
+#endif // _Express_Alias_HeaderFile
--- /dev/null
+// 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
--- /dev/null
+// 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
--- /dev/null
+// 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");
+}
--- /dev/null
+// 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 Standard_OVERRIDE;
+
+ DEFINE_STANDARD_RTTIEXT(Express_Boolean,Express_PredefinedType)
+
+protected:
+
+private:
+
+};
+
+#endif // _Express_Boolean_HeaderFile
--- /dev/null
+// 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 theImin,
+ const Standard_Integer theImax,
+ const Handle(Express_Type) &theType)
+{
+ myMin = theImin;
+ myMax = theImax;
+ myType = theType;
+}
+
+//=======================================================================
+//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) aType = myType;
+ if (aType->IsKind(STANDARD_TYPE(Express_ComplexType)))
+ {
+ Handle(Express_ComplexType) c2 = Handle(Express_ComplexType)::DownCast(aType);
+ aType = c2->Type();
+ }
+
+ // parse name of array argument
+ Handle(TCollection_HAsciiString) aName = aType->CPPName();
+ Standard_Integer split = aName->Location(1, '_', 1, aName->Length());
+ Handle(TCollection_HAsciiString) cls;
+ if (split)
+ {
+ cls = aName->Split(split);
+ }
+ else
+ {
+ cls = aName;
+ }
+ Handle(TCollection_HAsciiString) str = new TCollection_HAsciiString("TCollection");
+ Standard_Integer ind = aName->Location(str, 1, aName->Length());
+ if (ind)
+ {
+ aName = new TCollection_HAsciiString("Interface_");
+ }
+ // generate name
+ if (aType->IsStandard() || !split)
+ {
+ aName = new TCollection_HAsciiString("TColStd_");
+ }
+ if (aType == myType)
+ {
+ aName->AssignCat("HArray1Of");
+ }
+ else
+ {
+ aName->AssignCat("HArray2Of");
+ }
+ aName->AssignCat(cls);
+ return aName;
+}
+
+//=======================================================================
+//function : Use
+//purpose :
+//=======================================================================
+
+Standard_Boolean Express_ComplexType::Use(
+ const Handle(TCollection_HAsciiString) &thePack,
+ const Standard_Boolean theDefer) const
+{
+ return myType->Use(thePack, theDefer);
+}
--- /dev/null
+// 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 theImin,
+ const Standard_Integer theImax,
+ const Handle(Express_Type)& theType);
+
+ //! 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 Standard_OVERRIDE;
+
+ //! 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)& thePack,
+ const Standard_Boolean theDefer = Standard_False) const Standard_OVERRIDE;
+
+ DEFINE_STANDARD_RTTIEXT(Express_ComplexType,Express_Type)
+
+protected:
+
+private:
+
+ Standard_Integer myMin;
+ Standard_Integer myMax;
+ Handle(Express_Type) myType;
+
+};
+
+#endif // _Express_ComplexType_HeaderFile
--- /dev/null
+// 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
--- /dev/null
+// 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 theName,
+ const Handle(TColStd_HSequenceOfHAsciiString)& theInherit,
+ const Handle(Express_HSequenceOfField)& theFields)
+ : Express_Item(theName), mySupers(theInherit), myFields(theFields)
+{
+ // 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 theInherited) const
+{
+ Standard_Integer num = myFields->Length();
+ if (theInherited)
+ {
+ for (Standard_Integer i = 1; i <= myInherit->Length(); i++)
+ {
+ num += myInherit->Value(i)->NbFields(theInherited);
+ }
+ }
+ 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 my" << 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 ? "" : "&") << " the" << field->ToCString() << ")" << std::endl;
+ os << "{" << std::endl << " my" << field->ToCString() << " = the" << 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();
+ std::cout << "Generating ENTITY " << CPPname->ToCString() << std::endl;
+
+ // create a package directory (if not yet exist)
+ OSD_Protection prot(OSD_RWXD, OSD_RWXD, OSD_RWXD, OSD_RWXD);
+ TCollection_AsciiString pack = GetPackageName()->String();
+ OSD_Path path ( pack );
+ OSD_Directory dir ( path );
+ dir.Build ( prot );
+ pack += "/";
+ pack += CPPname->String();
+
+ //===============================
+ // Step 1: generating HXX
+
+ // Open HXX file
+ std::ofstream os(pack.Cat(".hxx").ToCString());
+
+ // write header
+ Express::WriteFileStamp(os);
+
+ Handle(TCollection_HAsciiString) InheritName = new TCollection_HAsciiString("Standard_Transient");
+ if (myInherit->Length() > 0)
+ { // first inherited class will be actually inherited
+ Handle(Express_Entity) it = myInherit->Value(1);
+ it->Use(GetPackageName());
+ InheritName = it->CPPName();
+ 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;
+ }
+ }
+
+ os << "#ifndef _" << CPPname->ToCString() << "_HeaderFile_" << std::endl;
+ os << "#define _" << CPPname->ToCString() << "_HeaderFile_" << std::endl;
+ os << std::endl;
+ os << "#include <Standard.hxx>" << std::endl;
+ os << "#include <Standard_Type.hxx>" << std::endl;
+ os << "#include <" << InheritName->ToCString() << ".hxx>" << std::endl;
+ os << std::endl;
+
+ // write includes section (also creates all used types)
+ DataMapOfStringInteger dict;
+ writeIncludes(os, dict);
+ os << std::endl;
+
+ os << "DEFINE_STANDARD_HANDLE(" << CPPname->ToCString() << ", " << InheritName->ToCString() << ")" << std::endl;
+ os << std::endl;
+
+ // write start of declaration (inheritance)
+ os << "//! Representation of STEP entity " << Name()->ToCString() << std::endl;
+ os << "class " << CPPname->ToCString() << " : public " << InheritName->ToCString();
+ os << std::endl << "{" << std::endl << std::endl;
+ os << "public :" << std::endl << std::endl;
+
+ // write constructor
+ os << " //! default constructor" << std::endl;
+ os << " Standard_EXPORT " << CPPname->ToCString() << "();" << std::endl;
+ os << std::endl;
+
+ // write Init methods
+ if ( myInherit->Length() > 1 || myFields->Length() > 0 ) {
+ os << " //! Initialize all fields (own and inherited)" << std::endl;
+ os << " Standard_EXPORT void Init(";
+ makeInit(os, 28, Standard_True, 0);
+ os << ");" << 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();
+ os << " //! Returns data for supertype " << name->ToCString() << std::endl;
+ os << " Standard_EXPORT Handle(" << it->CPPName()->ToCString()
+ << ") " << name->ToCString() << "() const;" << std::endl;
+ os << " //! Sets data for supertype " << name->ToCString() << std::endl;
+ os << " Standard_EXPORT void Set" << name->ToCString()
+ << " (const Handle(" << it->CPPName()->ToCString() << ")& the"<< name->ToCString() << ");" << std::endl;
+ os << std::endl;
+ }
+ for (Standard_Integer i = 1; i <= myFields->Length(); i++)
+ {
+ Handle(Express_Field) field = myFields->Value(i);
+ os << " //! Returns field " << field->Name()->ToCString() << std::endl;
+ if (field->Type()->IsHandle())
+ {
+ os << " Standard_EXPORT Handle(" << field->Type()->CPPName()->ToCString() << ") "
+ << field->Name()->ToCString() << "() const;" << std::endl;
+ }
+ else
+ {
+ os << " Standard_EXPORT " << field->Type()->CPPName()->ToCString() << " "
+ << field->Name()->ToCString() << "() const;" << std::endl;
+ }
+ os << std::endl;
+ os << " //! Sets field " << field->Name()->ToCString() << std::endl;
+ if (field->Type()->IsHandle())
+ {
+ os << " Standard_EXPORT void Set" << field->Name()->ToCString() << " (const Handle("
+ << field->Type()->CPPName()->ToCString() << ")& the" << field->Name()->ToCString() << ");" << std::endl;
+ }
+ else
+ {
+ os << " Standard_EXPORT void Set" << field->Name()->ToCString() << " (const "
+ << field->Type()->CPPName()->ToCString() << (field->Type()->IsSimple() ? "" : "&")
+ << " the" << field->Name()->ToCString() << ");" << std::endl;
+ }
+ if (field->IsOptional())
+ {
+ os << std::endl;
+ os << " //! Returns True if optional field " << field->Name()->ToCString() << " is defined" << std::endl;
+ os << " Standard_EXPORT Standard_Boolean Has" << field->Name()->ToCString() << "() const;" << std::endl;
+ }
+ os << std::endl;
+
+ // prepare additional methods for HArray1 field (NbField() and <field_elem> FieldValue(int num))
+ TCollection_AsciiString aTName = field->Type()->CPPName()->String();
+ Standard_Integer ns = aTName.Search("_HArray");
+ if (ns > -1)
+ {
+ TCollection_AsciiString namePack = aTName.SubString(1, ns);
+ TCollection_AsciiString nameClass("");
+ if (namePack.IsEqual("TColStd_"))
+ {
+ Standard_Integer ns2 = aTName.Search("Integer");
+ if (ns2 > -1)
+ {
+ nameClass = "Standard_Integer";
+ }
+ else
+ {
+ ns2 = aTName.Search("Real");
+ if (ns2 > -1)
+ {
+ nameClass = "Standard_Real";
+ }
+ else
+ {
+ nameClass = "Standard_Boolean";
+ }
+ }
+ }
+ else
+ {
+ if (namePack.IsEqual("Interface_"))
+ {
+ nameClass = "Handle(TCollection_HAsciiString)";
+ }
+ else
+ {
+ //nameClass = namePack;
+ nameClass = "Handle(";
+ nameClass.AssignCat(namePack);
+ nameClass.AssignCat(aTName.SubString(ns + 10, aTName.Length()));
+ nameClass.AssignCat(")");
+ }
+ }
+ os << " //! Returns number of " << field->Name()->ToCString() << std::endl;
+ os << " Standard_EXPORT Standard_Integer Nb" << field->Name()->ToCString() << "() const;" << std::endl;
+ os << std::endl;
+ os << " //! Returns value of " << field->Name()->ToCString() << " by its num" << std::endl;
+ os << " Standard_EXPORT "<< nameClass.ToCString() << " "<< field->Name()->ToCString()
+ << "Value(const Standard_Integer theNum) const;" << std::endl;
+ os << std::endl;
+ }
+
+ }
+
+ os << " DEFINE_STANDARD_RTTIEXT(" << CPPname->ToCString() << ", " << InheritName->ToCString() << ")" << std::endl;
+ os << std::endl;
+
+ // write fields section
+ if (myInherit->Length() > 1 || myFields->Length() > 0)
+ {
+ os << "private:" << std::endl << std::endl;
+ for (Standard_Integer i = 2; i <= myInherit->Length(); i++)
+ {
+ Handle(Express_Entity) it = myInherit->Value(i);
+ Handle(TCollection_HAsciiString) name = it->Name();
+ os << " Handle(" << it->CPPName()->ToCString() << ") my" << name->ToCString() << "; //!< supertype" << std::endl;
+ }
+ for (Standard_Integer i = 1; i <= myFields->Length(); i++)
+ {
+ Handle(Express_Field) field = myFields->Value(i);
+ if (field->Type()->IsHandle())
+ {
+ os << " Handle(" << field->Type()->CPPName()->ToCString() << ") my" << field->Name()->ToCString() << ";";
+ }
+ else
+ {
+ os << " " << field->Type()->CPPName()->ToCString() << " my" << field->Name()->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 << " Standard_Boolean myHas" << field->Name()->ToCString() << "; //!< flag \"is " <<
+ field->Name()->ToCString() << " defined\"" << std::endl;
+ }
+ os << std::endl;
+ }
+
+ // write end
+ os << "};" << std::endl << std::endl;
+ os << "#endif // _" << CPPname->ToCString() << "_HeaderFile_" << std::endl;
+ os.close();
+
+ //===============================
+ // Step 2: generating CXX
+
+ // Open CXX file
+ os.open(pack.Cat(".cxx").ToCString());
+
+ // write header
+ Express::WriteFileStamp(os);
+
+ // write include section
+ os << "#include <" << CPPname->ToCString() << ".hxx>" << std::endl;
+ os << std::endl;
+ os << "IMPLEMENT_STANDARD_RTTIEXT(" << CPPname->ToCString() << ", " << InheritName->ToCString() << ")" << 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 << " myHas" << 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())
+ {
+ 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 myHas" << field->Name()->ToCString() << ";\n}" << std::endl;
+ }
+
+ // prepare additional methods for HArray1 field
+ TCollection_AsciiString aTName = field->Type()->CPPName()->String();
+ Standard_Integer ns = aTName.Search("_HArray1");
+ if (ns > -1)
+ {
+ TCollection_AsciiString namePack = aTName.SubString(1, ns);
+ TCollection_AsciiString nameClass("");
+ if (namePack.IsEqual("TColStd_"))
+ {
+ Standard_Integer ns2 = aTName.Search("Integer");
+ if (ns2 > -1)
+ {
+ nameClass = "Standard_Integer";
+ }
+ else
+ {
+ ns2 = aTName.Search("Real");
+ if (ns2 > -1)
+ {
+ nameClass = "Standard_Real";
+ }
+ else
+ {
+ nameClass = "Standard_Boolean";
+ }
+ }
+ }
+ else
+ {
+ if (namePack.IsEqual("Interface_"))
+ {
+ nameClass = "Handle(TCollection_HAsciiString)";
+ }
+ else
+ {
+ //nameClass = namePack;
+ nameClass = "Handle(";
+ nameClass.AssignCat(namePack);
+ nameClass.AssignCat(aTName.SubString(ns + 10, aTName.Length()));
+ nameClass.AssignCat(")");
+ }
+ }
+ // write method ::NbField()
+ os << std::endl;
+ Handle(TCollection_HAsciiString) aMethodName = new TCollection_HAsciiString("Nb");
+ aMethodName->AssignCat(field->Name());
+ Express::WriteMethodStamp(os, aMethodName);
+ os << "Standard_Integer " << CPPname->ToCString() << "::Nb" << field->Name()->ToCString()
+ << "() const;" << std::endl;
+ os << "{" << std::endl;
+ os << " if (my" << field->Name()->ToCString() << ".IsNull())" << std::endl;
+ os << " {" << std::endl;
+ os << " return 0;" << std::endl;
+ os << " }" << std::endl;
+ os << " return my" << field->Name()->ToCString() << "->Length();" << std::endl;
+ os << "}" << std::endl;
+ // write method ::FieldValue(num)
+ os << std::endl;
+ aMethodName = new TCollection_HAsciiString(field->Name());
+ aMethodName->AssignCat("Value");
+ Express::WriteMethodStamp(os, aMethodName);
+ os << nameClass.ToCString() << " " << CPPname->ToCString() << "::" << field->Name()->ToCString()
+ << "Value(const Standard_Integer theNum) const;" << std::endl;
+ os << "{" << std::endl;
+ os << " return my" << field->Name()->ToCString() << "->Value(theNum);" << std::endl;
+ os << "}" << std::endl;
+ }
+
+ }
+
+ // close
+ os.close();
+
+ if (AbstractFlag())
+ {
+ // generation of RW class is not needed
+ return Standard_True;
+ }
+
+ //===============================
+ // Step 3: generating HXX for Reader/Writer class
+
+ // Open HXX file
+ Handle(TCollection_HAsciiString) RWCPPName = new TCollection_HAsciiString("RW");
+ RWCPPName->AssignCat(GetPackageName());
+ RWCPPName->AssignCat("_RW");
+ RWCPPName->AssignCat(Name());
+
+ pack = "RW";
+ pack += GetPackageName()->String();
+ OSD_Path rwpath(pack);
+ OSD_Directory rwdir(rwpath);
+ rwdir.Build(prot);
+ pack += "/";
+ pack += RWCPPName->String();
+
+ os.open(pack.Cat(".hxx").ToCString());
+
+ // write header
+ Express::WriteFileStamp(os);
+
+ os << "#ifndef _" << RWCPPName->ToCString() << "_HeaderFile_" << std::endl;
+ os << "#define _" << RWCPPName->ToCString() << "_HeaderFile_" << std::endl;
+ os << std::endl;
+
+ // write insludes
+ os << "#include <Standard.hxx>" << std::endl;
+ os << "#include <Standard_DefineAlloc.hxx>" << std::endl;
+ os << "#include <Standard_Handle.hxx>" << std::endl;
+ os << std::endl;
+ os << "class StepData_StepReaderData;" << std::endl;
+ os << "class Interface_Check;" << std::endl;
+ os << "class StepData_StepWriter;" << std::endl;
+ os << "class Interface_EntityIterator;" << std::endl;
+ os << "class " << CPPName()->ToCString() << ";" << std::endl;
+ os << std::endl;
+
+ // write start of declaration (inheritance)
+ os << "//! Read & Write tool for " << Name()->ToCString() << std::endl;
+ os << "class " << RWCPPName->ToCString() << std::endl;
+ os << "{" << std::endl << std::endl;
+ os << "public:" << std::endl;
+ os << std::endl << " DEFINE_STANDARD_ALLOC" << std::endl << std::endl;
+
+ // default constructor
+ os << " Standard_EXPORT " << RWCPPName->ToCString() << "();" << std::endl << std::endl;
+
+ // read step
+ os << " Standard_EXPORT void ReadStep(const Handle(StepData_StepReaderData)& theData," << std::endl;
+ os << " const Standard_Integer theNum," << std::endl;
+ os << " Handle(Interface_Check)& theCheck," << std::endl;
+ os << " const Handle(" << CPPName()->ToCString() << ")& theEnt) const;"
+ << std::endl << std::endl;
+
+ // write step
+ os << " Standard_EXPORT void WriteStep(StepData_StepWriter& theSW," << std::endl;
+ os << " const Handle(" << CPPName()->ToCString() << ")& theEnt) const;"
+ << std::endl << std::endl;
+
+ // share
+ os << " Standard_EXPORT void Share(const Handle(" << CPPName()->ToCString() << ")& theEnt," << std::endl;
+ os << " Interface_EntityIterator& theIter) const;" << std::endl << std::endl;
+
+ // write end
+ os << "};" << std::endl << std::endl;
+ os << "#endif // _" << RWCPPName->ToCString() << "_HeaderFile_" << 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);
+
+ // write include section
+ os << "#include <" << RWCPPName->ToCString() << ".hxx>" << std::endl;
+ dict.Clear();
+ os << "#include <" << CPPname->ToCString() << ".hxx>" << std::endl;
+ dict.Bind(CPPname->ToCString(), 1);
+ os << "#include <Interface_EntityIterator.hxx>" << std::endl;
+ os << "#include <StepData_StepReaderData.hxx>" << std::endl;
+ os << "#include <StepData_StepWriter.hxx>" << std::endl;
+ writeRWInclude(os, dict);
+ // write constructor
+ Express::WriteMethodStamp ( os, RWCPPName );
+ os << RWCPPName->ToCString() << "::" << RWCPPName->ToCString() << "() {}" << std::endl << std::endl;
+
+ // write method ReadStep
+ Express::WriteMethodStamp(os, new TCollection_HAsciiString("ReadStep"));
+ if (RWCPPName->Length() < 40)
+ {
+ os << "void " << RWCPPName->ToCString() << "::ReadStep (const Handle(StepData_StepReaderData)& theData," << std::endl;
+ writeSpaces(os, 17 + RWCPPName->Length());
+ os << "const Standard_Integer theNum," << std::endl;
+ writeSpaces(os, 17 + RWCPPName->Length());
+ os << "Handle(Interface_Check)& theCheck," << std::endl;
+ writeSpaces(os, 17 + RWCPPName->Length());
+ os << "const Handle(" << CPPname->ToCString() << ")& theEnt) const" << std::endl;
+ }
+ else
+ {
+ os << "void " << RWCPPName->ToCString() << "::ReadStep(" << std::endl;
+ os << " const Handle(StepData_StepReaderData)& theData," << std::endl;
+ os << " const Standard_Integer theNum," << std::endl;
+ os << " Handle(Interface_Check)& theCheck," << std::endl;
+ os << " const Handle(" << CPPname->ToCString() << ")& theEnt) const" << std::endl;
+ }
+ os << "{" << std::endl;
+ Standard_Integer nbFld = NbFields ( Standard_True );
+
+ os << " // Check number of parameters" << std::endl;
+ os << " if (!theData->CheckNbParams(theNum, " << nbFld << ", theCheck, \"" <<
+ Express::ToStepName(Name())->ToCString() << "\"))" << std::endl;
+ os << " {" << std::endl;
+ os << " return;" << std::endl;
+ os << " }" << std::endl;
+ writeRWReadCode(os, 1, Standard_True); // write code for reading inherited and own fields
+ os << std::endl;
+ os << " // Initialize entity" << std::endl;
+ os << " theEnt->Init(";
+ makeInit(os, 15, Standard_True, 4);
+ os << ");\n}" << std::endl;
+
+ // write method WriteStep
+ Express::WriteMethodStamp(os, new TCollection_HAsciiString("WriteStep"));
+ if (RWCPPName->Length() < 40)
+ {
+ os << "void " << RWCPPName->ToCString() << "::WriteStep (StepData_StepWriter& theSW," << std::endl;
+ writeSpaces(os, 18 + RWCPPName->Length());
+ os << "const Handle(" << CPPname->ToCString() << ")& theEnt) const" << std::endl;
+ }
+ else
+ {
+ os << "void " << RWCPPName->ToCString() << "::WriteStep(" << std::endl;
+ os << " StepData_StepWriter& theSW," << std::endl;
+ os << " const Handle(" << CPPname->ToCString() << ")& theEnt) const" << std::endl;
+ }
+ os << "{" << 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"));
+ std::ostringstream oos;
+ Standard_Integer nbF = writeRWShareCode(oos, 1, Standard_True); // write code for filling graph of references
+ if (RWCPPName->Length() < 40)
+ {
+ os << "void " << RWCPPName->ToCString() << "::Share (const Handle(" << CPPname->ToCString() << ")&";
+ os << ((nbF > 1) ? "theEnt," : ",") << std::endl;
+ writeSpaces(os, 14 + RWCPPName->Length());
+ if (nbF > 1)
+ {
+ os << "Interface_EntityIterator& theIter) const" << std::endl;
+ }
+ else
+ {
+ os << "Interface_EntityIterator&) const" << std::endl;
+ }
+ }
+ else
+ {
+ os << "void " << RWCPPName->ToCString() << "::Share(" << std::endl;
+ os << " const Handle(" << CPPname->ToCString() << ")&";
+ os<< ((nbF > 1) ? "theEnt," : ",") << std::endl;
+ if (nbF > 1)
+ {
+ os << "Interface_EntityIterator& theIter) const" << std::endl;
+ }
+ else
+ {
+ os << "Interface_EntityIterator&) const" << std::endl;
+ }
+ }
+ os << "{" << std::endl;
+ if (nbF > 1)
+ {
+ os << oos.str();
+ }
+ 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();
+
+ //===============================
+ // Step 5: adding method for registartion of entities and include
+
+ Standard_Integer anIndex = Express_Item::Index();
+ TCollection_AsciiString regDir = "Registration";
+ OSD_Path path_reg(regDir);
+ OSD_Directory dir_reg(regDir);
+ dir_reg.Build(prot);
+ regDir += "/";
+
+ TCollection_AsciiString packname_inc = "inc.txt";
+ TCollection_AsciiString packname_rwinc = "rwinc.txt";
+ // write file with includes
+ os.open(regDir.Cat(packname_inc).ToCString(), std::ios::app);
+ os << "#include <" << CPPName()->ToCString() << ".hxx>" << std::endl;
+ os.close();
+ // write file with RW includes
+ os.open(regDir.Cat(packname_rwinc).ToCString(), std::ios::app);
+ os << "#include <" << RWCPPName->ToCString() << ".hxx>" << std::endl;
+ os.close();
+
+ // generate data for entity registration
+ if (anIndex > 0)
+ {
+ // StepAP214_Protocol.cxx
+ TCollection_AsciiString packname_protocol = "protocol.txt";
+ os.open(regDir.Cat(packname_protocol).ToCString(), std::ios::app);
+ os << "types.Bind(STANDARD_TYPE(" << CPPName()->ToCString() << "), " << anIndex << ");" << std::endl;
+ os.close();
+ // RWStepAP214_GeneralModule.cxx
+ // FillSharedCase
+ TCollection_AsciiString packname_fillshared = "fillshared.txt";
+ os.open(regDir.Cat(packname_fillshared).ToCString(), std::ios::app);
+ os << " case " << anIndex << ":" << std::endl;
+ os << " {" << std::endl;
+ os << " DeclareAndCast(" << CPPName()->ToCString() << ", anent, ent);" << std::endl;
+ os << " " << RWCPPName->ToCString() << " tool;" << std::endl;
+ os << " tool.Share(anent, iter);" << std::endl;
+ os << " }" << std::endl;
+ os << " break;" << std::endl;
+ os.close();
+ // NewVoid
+ TCollection_AsciiString packname_newvoid = "newvoid.txt";
+ os.open(regDir.Cat(packname_newvoid).ToCString(), std::ios::app);
+ os << " case " << anIndex << ":" << std::endl;
+ os << " ent = new " << CPPName()->ToCString() << ";" << std::endl;
+ os << " break;" << std::endl;
+ os.close();
+ // CategoryNumber
+ TCollection_AsciiString packname_category = "category.txt";
+ os.open(regDir.Cat(packname_category).ToCString(), std::ios::app);
+ os << " case " << anIndex << ": return " << Category()->ToCString() << ";" << std::endl;
+ os.close();
+ // RWStepAP214_ReadWriteModule.cxx
+ // Reco
+ Handle(TCollection_HAsciiString) recoName = Express::ToStepName(Name());
+ recoName->UpperCase();
+ TCollection_AsciiString packname_reco = "reco.txt";
+ os.open(regDir.Cat(packname_reco).ToCString(), std::ios::app);
+ os << " static TCollection_AsciiString Reco_" << Name()->ToCString() << "(\""
+ << recoName->ToCString() << "\");" << std::endl;
+ os.close();
+ //type bind
+ TCollection_AsciiString packname_typebind = "typebind.txt";
+ os.open(regDir.Cat(packname_typebind).ToCString(), std::ios::app);
+ os << " typenums.Bind(Reco_" << Name()->ToCString() << ", " << anIndex << ");" << std::endl;
+ os.close();
+ // StepType
+ TCollection_AsciiString packname_steptype = "steptype.txt";
+ os.open(regDir.Cat(packname_steptype).ToCString(), std::ios::app);
+ os << " case " << anIndex << ": return Reco_" << Name()->ToCString() << ";" << std::endl;
+ os.close();
+ // ReadStep
+ TCollection_AsciiString packname_readstep = "readstep.txt";
+ os.open(regDir.Cat(packname_readstep).ToCString(), std::ios::app);
+ os << " case " << anIndex << ":" << std::endl;
+ os << " {" << std::endl;
+ os << " DeclareAndCast(" << CPPName()->ToCString() << ", anent, ent);" << std::endl;
+ os << " " << RWCPPName->ToCString() << " tool;" << std::endl;
+ os << " tool.ReadStep(data, num, ach, anent);" << std::endl;
+ os << " }" << std::endl;
+ os << " break;" << std::endl;
+ os.close();
+ // WriteStep
+ TCollection_AsciiString packname_writestep = "writestep.txt";
+ os.open(regDir.Cat(packname_writestep).ToCString(), std::ios::app);
+ os << " case " << anIndex << ":" << std::endl;
+ os << " {" << std::endl;
+ os << " DeclareAndCast(" << CPPName()->ToCString() << ", anent, ent);" << std::endl;
+ os << " " << RWCPPName->ToCString() << " tool;" << std::endl;
+ os << " tool.WriteStep(SW, anent);" << std::endl;
+ os << " }" << std::endl;
+ os << " break;" << std::endl;
+ os.close();
+ Express_Item::SetIndex(anIndex + 1);
+ }
+
+ return Standard_True;
+}
+
+//=======================================================================
+//function : WriteIncludes
+//purpose :
+//=======================================================================
+
+Standard_Boolean Express_Entity::writeIncludes(
+ Standard_OStream& theOs,
+ DataMapOfStringInteger& theDict) const
+{
+ for (Standard_Integer i = 2; i <= myInherit->Length(); i++)
+ {
+ Handle(Express_Entity) it = myInherit->Value(i);
+ it->writeIncludes(theOs, theDict);
+ if (i <= 1)
+ {
+ continue;
+ }
+
+ if (theDict.IsBound(it->CPPName()->String()))
+ {
+ continue; // avoid duplicating
+ }
+ theDict.Bind(it->CPPName()->String(), 1);
+ it->Use(GetPackageName());
+ theOs << "#include <" << it->CPPName()->ToCString() << ".hxx>" << std::endl;
+ }
+ for (Standard_Integer i = 1; i <= myFields->Length(); i++)
+ {
+ Handle(Express_Type) type = myFields->Value(i)->Type();
+ if (theDict.IsBound(type->CPPName()->String()))
+ {
+ continue; // avoid duplicating
+ }
+ theDict.Bind(type->CPPName()->String(), 1);
+ type->Use(GetPackageName());
+ if (type->IsStandard())
+ {
+ continue;
+ }
+ theOs << "#include <" << type->CPPName()->ToCString() << ".hxx>" << std::endl;
+ // check that last include is for array
+ TCollection_AsciiString namePack = GetPackageName()->String();
+ TCollection_AsciiString aStrForSearch = namePack;
+ aStrForSearch.AssignCat("_HArray");
+ Standard_Integer ns = type->CPPName()->Search(aStrForSearch.ToCString());
+ if (ns > -1)
+ {
+ // create hxx files for Array1 and HArray1
+ // prepare file names
+ ns = namePack.Length();
+ TCollection_AsciiString nameHA = type->CPPName()->String();
+ TCollection_AsciiString nameA = nameHA.SubString(1, ns + 1);
+ nameA.AssignCat(nameHA.SubString(ns + 3, nameHA.Length()));
+ TCollection_AsciiString nameClass = nameHA.SubString(ns + 11, nameHA.Length());
+ // Open HXX file
+ TCollection_AsciiString fnameA = namePack;
+ fnameA.AssignCat("/");
+ fnameA.AssignCat(nameA);
+ std::ofstream osa(fnameA.Cat(".hxx").ToCString());
+ // write header
+ Express::WriteFileStamp(osa);
+ osa << std::endl;
+ osa << "#ifndef " << nameA.ToCString() << "_HeaderFile" << std::endl;
+ osa << "#define " << nameA.ToCString() << "_HeaderFile" << std::endl;
+ osa << std::endl;
+ osa << "#include <" << namePack.ToCString() << "_" << nameClass.ToCString() << ".hxx>" << std::endl;
+ osa << "#include <NCollection_" << nameHA.SubString(ns + 3, ns + 8) << ".hxx>" << std::endl;
+ osa << std::endl;
+ osa << "typedef NCollection_" << nameHA.SubString(ns + 3, ns + 8) << "<Handle("
+ << namePack.ToCString() << "_" << nameClass.ToCString() << ")> " << nameA.ToCString() << ";" << std::endl;
+ osa << std::endl;
+ osa << "#endif" << std::endl;
+ osa.close();
+ // Open HXX file
+ TCollection_AsciiString fnameHA = namePack;
+ fnameHA.AssignCat("/");
+ fnameHA.AssignCat(nameHA);
+ std::ofstream osha(fnameHA.Cat(".hxx").ToCString());
+ // write header
+ Express::WriteFileStamp(osha);
+ osha << std::endl;
+ osha << "#ifndef " << nameHA.ToCString() << "_HeaderFile" << std::endl;
+ osha << "#define " << nameHA.ToCString() << "_HeaderFile" << std::endl;
+ osha << std::endl;
+ osha << "#include <" << nameA << ".hxx>" << std::endl;
+ osha << "#include <NCollection_" << nameHA.SubString(ns + 2, ns + 8) << ".hxx>" << std::endl;
+ osha << std::endl;
+ osha << "DEFINE_HARRAY"<< nameHA.SubString(ns + 8, ns + 8) <<"(" << nameHA.ToCString()
+ << ", " << nameA.ToCString() << ");" << std::endl;
+ osha << std::endl;
+ osha << "#endif" << std::endl;
+ osha.close();
+ }
+
+ }
+ return Standard_True;
+}
+
+//=======================================================================
+//function : WriteRWInclude
+//purpose :
+//=======================================================================
+
+void Express_Entity::writeRWInclude (Standard_OStream& theOs, DataMapOfStringInteger& theDict) 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
+ theOs << "#include <" << it->CPPName()->ToCString() << ".hxx>" << std::endl;
+ }
+ it->writeRWInclude(theOs, theDict);
+ }
+ 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 (theDict.IsBound(type->CPPName()->String()))
+ {
+ break; // avoid duplicating
+ }
+ theDict.Bind(type->CPPName()->String(), 1);
+ theOs << "#include <" << type->CPPName()->ToCString() << ".hxx>" << std::endl;
+
+ Handle(Express_ComplexType) complex = Handle(Express_ComplexType)::DownCast(type);
+ if (complex.IsNull())
+ {
+ break;
+ }
+ type = complex->Type();
+ }
+ }
+}
+
+//=======================================================================
+//function : typeToSTEPName
+//purpose : auxilary for WriteRWReadField
+//=======================================================================
+
+static Handle(TCollection_HAsciiString) typeToSTEPName(const Handle(Express_Type)& theType)
+{
+ Handle(TCollection_HAsciiString) cppname = theType->CPPName();
+ Handle(TCollection_HAsciiString) cls = cppname->Token("_", 2);
+ if (cls->Length() < 1)
+ {
+ cls = cppname;
+ }
+ return Express::ToStepName(cls);
+}
+
+//=======================================================================
+//function : WriteRWReadField
+//purpose :
+//=======================================================================
+
+static void writeRWReadField(
+ Standard_OStream& theOs,
+ 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("theNum");
+ if (lev > 0)
+ {
+ param = TCollection_AsciiString("num");
+ 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())
+ {
+ theOs << shift << "Handle(" << type->CPPName()->ToCString() << ") a";
+ }
+ else
+ {
+ theOs << shift << type->CPPName()->ToCString() << " a";
+ }
+ theOs << varname << ";" << std::endl;
+
+ if (optional)
+ {
+ theOs << shift << "Standard_Boolean has" << varname << " = Standard_True;" << std::endl;
+ theOs << shift << "if (theData->IsParamDefined(" << param << ", " << index << "))" << std::endl;
+ theOs << shift << "{" << 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)))
+ {
+ theOs << shift << "theData->ReadEntity(" << param << ", " << index << ", \"" << STEPName << "\", theCheck," << std::endl;
+ theOs << shift << " STANDARD_TYPE(" << named->CPPName()->ToCString() << "), a" << varname << ");" << std::endl;
+ }
+ else if (named->Item()->IsKind(STANDARD_TYPE(Express_Select)))
+ {
+ theOs << shift << "theData->ReadEntity(" << param << ", " << index << ", \"" << STEPName <<
+ "\", theCheck, a" << varname << ");" << std::endl;
+ }
+ else if (named->Item()->IsKind(STANDARD_TYPE(Express_Enum)))
+ {
+ theOs << shift << "if (theData->ParamType(" << param << ", " <<
+ index << ") == Interface_ParamEnum)" << std::endl;
+ theOs << shift << "{" << std::endl;
+ theOs << shift << " Standard_CString text = theData->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();
+ theOs << shift << (i == 1 ? " if " : " else if") <<
+ " (strcmp(text, \"." << ename->ToCString() << ".\")) a" <<
+ varname << " = " << enpack.ToCString() << "_" << prefix->ToCString() <<
+ names->Value(i)->ToCString() << ";" << std::endl;
+ }
+ theOs << shift << " else" << std::endl;
+ theOs << shift << " {" << std::endl;
+ theOs << shift << " theCheck->AddFail(\"Parameter #" << index << " (" << STEPName
+ << ") has not allowed value\");" << std::endl;
+ theOs << shift << " }" << std::endl;
+ theOs << shift << "}" << std::endl;
+ theOs << shift << "else" << std::endl;
+ theOs << shift << "{" << std::endl;
+ theOs << shift << " theCheck->AddFail(\"Parameter #" << index << " (" << STEPName
+ << ") is not enumeration\");" << std::endl;
+ theOs << shift << "}" << std::endl;
+ //theOs << "!!! 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);
+ theOs << shift << "Standard_Integer sub" << index << " = 0;" << std::endl;
+ theOs << shift << "if (theData->ReadSubList(" << param << ", " << index << ", \"" <<
+ STEPName << "\", theCheck, sub" << index << "))" << std::endl;
+ theOs << shift << "{" << std::endl;
+ theOs << shift << " Standard_Integer nb" << lev << " = theData->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");
+ theOs << shift << " Standard_Integer nbj" << lev <<
+ " = theData->NbParams(theData->ParamNumber(sub" << index << ",1));" << std::endl;
+ theOs << shift << " a" << varname << " = new " << type->CPPName()->ToCString() <<
+ "(1, nb" << lev << ", 1, nbj" << lev << ");" << std::endl;
+ theOs << shift << " for (Standard_Integer " << iter << " = 1; " << iter << " <= nb"
+ << lev << "; " << iter << "++)" << std::endl;
+ theOs << shift << " {" << std::endl;
+ theOs << shift << " Standard_Integer subj" << index << " = 0;" << std::endl;
+ theOs << shift << " if ( theData->ReadSubList (sub" << index << ", " << iter << ", \"sub-part(" <<
+ STEPName << ")\", theCheck, subj" << index << ") ) {" << std::endl;
+ theOs << shift << " Standard_Integer num" << level + 2 << " = subj" << index << ";" << std::endl;
+ theOs << shift << " for (Standard_Integer " << jter << " = 1; " << jter << " <= nbj" << lev <<
+ "; " << jter << "++)" << std::endl;
+ theOs << shift << " {" << std::endl;
+ Handle(TCollection_HAsciiString) subName = typeToSTEPName(complex2->Type());
+ writeRWReadField(theOs, jter.ToCString(), subName->ToCString(), var.ToCString(),
+ complex2->Type(), level + 2, Standard_False);
+ theOs << shift << " a" << varname << "->SetValue(" << iter << "," <<
+ jter << ", a" << var << ");" << std::endl;
+ theOs << shift << " }" << std::endl;
+ theOs << shift << " }" << std::endl;
+ }
+ else
+ { // simple array
+ theOs << shift << " a" << varname << " = new " << type->CPPName()->ToCString() <<
+ "(1, nb" << lev << ");" << std::endl;
+ theOs << shift << " Standard_Integer num" << level << " = sub" << index << ";" << std::endl;
+ theOs << shift << " for (Standard_Integer " << iter << " = 1; " << iter << " <= nb" << lev <<
+ "; " << iter << "++)" << std::endl;
+ theOs << shift << " {" << std::endl;
+ Handle(TCollection_HAsciiString) subName = typeToSTEPName(complex->Type());
+ writeRWReadField(theOs, iter.ToCString(), subName->ToCString(), var.ToCString(),
+ complex->Type(), level, Standard_False);
+ theOs << shift << " a" << varname << "->SetValue(" << iter << ", a" << var << ");" << std::endl;
+ }
+ theOs << shift << " }" << std::endl;
+ theOs << shift << "}" << std::endl;
+ }
+ else if (type->IsKind(STANDARD_TYPE(Express_String)))
+ {
+ if (strlen(STEPName) + strlen(varname) < 70)
+ {
+ theOs << shift << "theData->ReadString(" << param << ", " << index << ", \"" << STEPName
+ << "\", theCheck, a" << varname << ");" << std::endl;
+ }
+ else
+ {
+ theOs << shift << "theData->ReadString(" << param << ", " << index << ", \"" << STEPName
+ << "\", theCheck," << std::endl;
+ theOs << shift << " a" << varname << ");" << std::endl;
+ }
+ }
+ else if (type->IsKind(STANDARD_TYPE(Express_Logical)))
+ {
+ theOs << shift << "theData->ReadLogical(" << param << ", " << index << ", \"" << STEPName <<
+ "\", theCheck, a" << varname << ");" << std::endl;
+ }
+ else if (type->IsKind(STANDARD_TYPE(Express_Boolean)))
+ {
+ theOs << shift << "theData->ReadBoolean(" << param << ", " << index << ", \"" << STEPName <<
+ "\", theCheck, a" << varname << ");" << std::endl;
+ }
+ else if (type->IsKind(STANDARD_TYPE(Express_Number)) || type->IsKind(STANDARD_TYPE(Express_Integer)))
+ {
+ theOs << shift << "theData->ReadInteger(" << param << ", " << index << ", \"" << STEPName <<
+ "\", theCheck, a" << varname << ");" << std::endl;
+ }
+ else if (type->IsKind(STANDARD_TYPE(Express_Real)))
+ {
+ theOs << shift << "theData->ReadReal(" << param << ", " << index << ", \"" << STEPName <<
+ "\", theCheck, a" << varname << ");" << std::endl;
+ }
+
+ if (optional)
+ {
+ shift.Remove(1, 2);
+ theOs << shift << "}" << std::endl;
+ theOs << shift << "else" << std::endl;
+ theOs << shift << "{" << std::endl;
+ theOs << shift << " has" << varname << " = Standard_False;" << std::endl;
+ theOs << shift << " a" << varname;
+ if (type->IsHandle())
+ {
+ theOs << ".Nullify();";
+ }
+ else if (type->IsStandard())
+ {
+ theOs << " = 0;";
+ }
+ else
+ {
+ theOs << " = " << type->CPPName()->ToCString() << "();";
+ }
+ theOs << std::endl;
+ theOs << shift << "}" << std::endl;
+ }
+}
+
+//=======================================================================
+//function : WriteRWReadCode
+//purpose :
+//=======================================================================
+
+Standard_Integer Express_Entity::writeRWReadCode (Standard_OStream& theOs,
+ const Standard_Integer theStart,
+ const Standard_Integer theOwn) const
+{
+ Standard_Integer num = theStart;
+
+ // write code for reading inherited fields
+ for (Standard_Integer i = 1; i <= myInherit->Length(); i++)
+ {
+ num = myInherit->Value(i)->writeRWReadCode(theOs, num, Standard_False);
+ }
+
+ // write code for reading own fields
+ if ( myFields->Length() >0 )
+ {
+ if ( num >0 ) theOs << std::endl;
+ theOs << " // " << (theOwn ? "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 (!theOwn)
+ {
+ STEPName->Prepend(Express::ToStepName(Name()->Cat(".")));
+ }
+ Handle(TCollection_HAsciiString) varName = new TCollection_HAsciiString(field->Name());
+ if (!theOwn)
+ {
+ varName->Prepend(Name()->Cat("_"));
+ }
+ theOs << std::endl;
+ writeRWReadField(theOs, TCollection_AsciiString(num).ToCString(), STEPName->ToCString(),
+ varName->ToCString(), field->Type(), 0, field->IsOptional());
+ num++;
+ }
+ return num;
+}
+
+//=======================================================================
+//function : WriteRWWriteField
+//purpose :
+//=======================================================================
+
+static void writeRWWriteField(
+ Standard_OStream &theOs,
+ 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");
+ theOs << shift << "theSW.OpenSub();" << std::endl;
+ theOs << 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();
+ theOs << varname << "->RowLength(); i" << index << "++)" << std::endl;
+ theOs << shift << "{" << std::endl;
+ theOs << shift << " theSW.NewLine(Standard_False);" << std::endl;
+ theOs << shift << " theSW.OpenSub();" << std::endl;
+ theOs << shift << " for (Standard_Integer j" << index << " = 1; j" << index << " <= " <<
+ varname << "->ColLength(); j" << index << "++)" << std::endl;
+ theOs << shift << " {" << std::endl;
+ theOs << shift << " " << (type->IsHandle() ? " Handle(" : " ") << type->CPPName()->ToCString() <<
+ (type->IsHandle() ? ") " : " ") << var.ToCString() << " = " <<
+ varname << "->Value(i" << index << ",j" << index << ");" << std::endl;
+ writeRWWriteField(theOs, var.ToCString(), type, index + 1, level + 1);
+ theOs << shift << " }" << std::endl;
+ theOs << shift << " theSW.CloseSub();" << std::endl;
+ }
+ else
+ { // simple array
+ theOs << varname << "->Length(); i" << index << "++)" << std::endl;
+ theOs << shift << "{" << std::endl;
+ theOs << shift << (type->IsHandle() ? " Handle(" : " ") << type->CPPName()->ToCString() <<
+ (type->IsHandle() ? ") " : " ") << var.ToCString() << " = " <<
+ varname << "->Value(i" << index << ");" << std::endl;
+ writeRWWriteField(theOs, var.ToCString(), type, index + 1, level);
+ }
+ theOs << shift << "}" << std::endl;
+ theOs << shift << "theSW.CloseSub();" << std::endl;
+ }
+ else if (type->IsKind(STANDARD_TYPE(Express_Boolean)))
+ {
+ theOs << shift << "theSW.SendBoolean(" << varname << ");" << std::endl;
+ }
+ else if (type->IsKind(STANDARD_TYPE(Express_Logical)))
+ {
+ theOs << shift << "theSW.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();
+ theOs << shift << "switch (" << varname << ")" << std::endl;
+ theOs << shift << "{" << std::endl;
+ for (Standard_Integer i = 1; i <= names->Length(); i++)
+ {
+ Handle(TCollection_HAsciiString) ename = Express::ToStepName(names->Value(i));
+ ename->UpperCase();
+ theOs << shift << " case " << enpack.ToCString() << "_" << prefix->ToCString() <<
+ names->Value(i)->ToCString() << ": theSW.SendEnum(\"." <<
+ ename->ToCString() << ".\"); break;" << std::endl;
+ }
+ theOs << shift << "}" << std::endl;
+ }
+ else
+ {
+ theOs << shift << "theSW.Send(" << varname;
+ if (!named.IsNull() && named->Item()->IsKind(STANDARD_TYPE(Express_Select)))
+ {
+ theOs << ".Value()";
+ }
+ theOs << ");" << std::endl;
+ }
+ }
+}
+
+//=======================================================================
+//function : WriteRWWriteCode
+//purpose :
+//=======================================================================
+
+Standard_Integer Express_Entity::writeRWWriteCode(
+ Standard_OStream &theOs,
+ const Standard_Integer theStart,
+ const Standard_Integer theOwn) const
+{
+ Standard_Integer num = theStart;
+
+ // write code for writing inherited fields
+ for (Standard_Integer i = 1; i <= myInherit->Length(); i++)
+ {
+ num = myInherit->Value(i)->writeRWWriteCode(theOs, num, (i > 1 ? -1 : 1));
+ }
+
+ // write code for writing own fields
+ if (myFields->Length() > 0)
+ {
+ theOs << std::endl;
+ theOs << " // " << (theOwn == 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 (!theOwn)
+ {
+ varName.Prepend(CPPName()->Cat("::")->String());
+ }
+ else if (theOwn == -1)
+ { // inherited base class implemented as field
+ varName.Prepend ( Name()->Cat ( "()->" )->String() );
+ }
+ varName.Prepend ( "theEnt->" );
+ varName.AssignCat ( "()" );
+ theOs << std::endl;
+
+ if (field->IsOptional())
+ {
+ theOs << " if (theEnt->";
+ if (!theOwn)
+ {
+ theOs << CPPName()->ToCString() << "::";
+ }
+ else if (theOwn == -1)
+ {
+ theOs << Name()->ToCString() << "()->";
+ }
+ theOs << "Has" << field->Name()->ToCString() << "())" << std::endl;
+ theOs << " {" << std::endl;
+ }
+ writeRWWriteField(theOs, varName.ToCString(), field->Type(), num, (field->IsOptional() ? 1 : 0));
+ if (field->IsOptional())
+ {
+ theOs << " }" << std::endl;
+ theOs << " else" << std::endl;
+ theOs << " {" << std::endl;
+ theOs << " theSW.SendUndef();" << std::endl;
+ theOs << " }" << std::endl;
+ }
+ num++;
+ }
+
+ return num;
+}
+
+//=======================================================================
+//function : WriteRWShareField
+//purpose :
+//=======================================================================
+
+static Standard_Boolean writeRWShareField(
+ Standard_OStream &theOs,
+ 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;
+ }
+ theOs << shift << "for (Standard_Integer i" << index << " = 1; i" << index << " <= " <<
+ varname << "->Length(); i" << index << "++)" << std::endl;
+ theOs << shift << "{" << std::endl;
+ theOs << shift << (type->IsHandle() ? " Handle(" : " ") << type->CPPName()->ToCString() <<
+ (type->IsHandle() ? ") " : " ") << var.ToCString() << " = " <<
+ varname << "->Value(i" << index << ");" << std::endl;
+
+ theOs << oos.str();
+ theOs << 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)))
+ {
+ theOs << shift << "theIter.AddItem(" << varname << ");" << std::endl;
+ return Standard_True;
+ }
+ if (named->Item()->IsKind(STANDARD_TYPE(Express_Select)))
+ {
+ theOs << shift << "theIter.AddItem(" << varname << ".Value());" << std::endl;
+ return Standard_True;
+ }
+ }
+ return Standard_False;
+}
+
+//=======================================================================
+//function : WriteRWShareCode
+//purpose :
+//=======================================================================
+
+Standard_Integer Express_Entity::writeRWShareCode(
+ Standard_OStream &theOs,
+ const Standard_Integer theStart,
+ const Standard_Integer theOwn) const
+{
+ Standard_Integer num = theStart;
+
+ // write code for sharing inherited fields
+ for (Standard_Integer i = 1; i <= myInherit->Length(); i++)
+ {
+ num = myInherit->Value(i)->writeRWShareCode(theOs, num, (i > 1 ? -1 : Standard_False));
+ }
+
+ // write code for sharing own fields
+ if ( myFields->Length() >0 )
+ {
+ theOs << std::endl;
+ theOs << " // " << (theOwn == 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 (!theOwn)
+ {
+ varName.Prepend(CPPName()->Cat("::")->String());
+ }
+ else if (theOwn == -1)
+ { // inherited base class implemented as field
+ varName.Prepend(Name()->Cat("()->")->String());
+ }
+ varName.Prepend("theEnt->");
+ varName.AssignCat("()");
+
+ std::ostringstream oos;
+ if (!writeRWShareField(oos, varName.ToCString(), field->Type(), num, (field->IsOptional() ? 1 : 0)))
+ {
+ continue;
+ }
+ num++;
+ theOs << std::endl;
+ if (field->IsOptional())
+ {
+ theOs << " if (theEnt->";
+ if (!theOwn) theOs << CPPName()->ToCString() << "::";
+ else if (theOwn == -1) theOs << Name()->ToCString() << "()->";
+ theOs << "Has" << field->Name()->ToCString() << "())" << std::endl;
+ theOs << " {" << std::endl;
+ }
+
+ theOs << oos.str();
+ if (field->IsOptional())
+ {
+ theOs << " }" << std::endl;
+ }
+ }
+ return num;
+}
+
+//=======================================================================
+//function : MakeInit
+//purpose :
+//=======================================================================
+
+Standard_Integer Express_Entity::makeInit (Standard_OStream &theOs,
+ const Standard_Integer theShift,
+ const Standard_Integer theOwn,
+ const Standard_Integer theMode) const
+{
+ Standard_Integer sh = theShift;
+
+ // write code for inherited fields
+ for (Standard_Integer i = 1; i <= myInherit->Length(); i++)
+ {
+ Handle(Express_Entity) ent = myInherit->Value(i);
+ if (theMode == 3)
+ {
+ Standard_Integer s = 0;
+ if (i > 1)
+ {
+ theOs << "\n my" << ent->Name()->ToCString() << " = new " << ent->CPPName()->ToCString() << ";";
+ theOs << "\n my" << ent->Name()->ToCString() << "->Init(";
+ s = 12 + ent->Name()->Length();
+ }
+ else
+ {
+ theOs << "\n " << ent->CPPName()->ToCString() << "::Init(";
+ s = 9 + ent->CPPName()->Length();
+ }
+ ent->makeInit(theOs, s, Standard_False, 2);
+ theOs << ");";
+ }
+ else
+ {
+ sh = ent->makeInit(theOs, sh, (i > 1 ? -1 : Standard_False), theMode);
+ }
+ }
+
+ // 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 (theOwn != 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 = (theMode == 0 ? ',' : (theMode == 3 ? '\n' : ','));
+ if (sh < 0)
+ {
+ if (i == 1 && myInherit->Length() == 0 && theMode == 3)
+ {
+ theOs << delim << space;
+
+ }
+ else if (theMode == 4)
+ {
+ theOs << ", ";
+ }
+ else
+ {
+ theOs << delim << "\n" << space;
+ }
+ }
+ else
+ {
+ sh = -sh;
+ }
+
+ if (field->IsOptional())
+ {
+ if (theMode == 0)
+ {
+ theOs << "const Standard_Boolean theHas" << varName->ToCString() << ",\n" << space;
+ }
+ else if (theMode == 1)
+ {
+ theOs << "const Standard_Boolean theHas" << varName->ToCString() << ",\n" << space;
+ }
+ else if (theMode == 2)
+ {
+ theOs << "has" << varName->ToCString() << ",\n" << space;
+ }
+ else if (theMode == 4)
+ {
+ theOs << "has" << varName->ToCString() << ", ";
+ }
+ }
+
+ // write field
+ if (theMode == 0 || theMode == 1)
+ {
+ theOs << "const " << (field->Type()->IsHandle() ? "Handle(" : "") <<
+ field->Type()->CPPName()->ToCString() << (field->Type()->IsHandle() ? ")" : "") <<
+ (field->Type()->IsSimple() ? " the" : "& the") << varName->ToCString();
+ }
+ else if (theMode == 2)
+ {
+ theOs << "the" << varName->ToCString();
+ }
+ else if (theMode == 4)
+ {
+ theOs << "a" << varName->ToCString();
+ }
+ else
+ {
+ if (field->IsOptional())
+ {
+ theOs << "myHas" << field->Name()->ToCString() << " = theHas" << varName->ToCString() << ";" << std::endl;
+ theOs << " if (myHas" << field->Name()->ToCString() << ")" << std::endl;
+ theOs << " {" << std::endl;
+ theOs << " my" << field->Name()->ToCString() << " = the" << varName->ToCString() << ";";
+ theOs << "\n }" << std::endl;
+ theOs << " else" << std::endl;
+ theOs << " {" << std::endl;
+ theOs << " my" << field->Name()->ToCString();
+ if (field->Type()->IsHandle())
+ {
+ theOs << ".Nullify();";
+ }
+ else if (field->Type()->IsStandard())
+ {
+ theOs << " = 0;";
+ }
+ else
+ {
+ theOs << " = " << field->Type()->CPPName()->ToCString() << "();";
+ }
+ theOs << "\n }";
+ }
+ else
+ {
+ theOs << "my" << field->Name()->ToCString() << " = the" << varName->ToCString() << ";";
+ }
+ }
+ 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;
+}
+
--- /dev/null
+// 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 theName,
+ const Handle(TColStd_HSequenceOfHAsciiString)& theInherit,
+ const Handle(Express_HSequenceOfField)& theFields);
+
+ //! 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 theInherited = Standard_False) const;
+
+ //! Sets abstruct flag for entity;
+ Standard_EXPORT void SetAbstractFlag (const Standard_Boolean theIsAbstract) ;
+
+ //! 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 HXX/CXX files from item
+ Standard_EXPORT virtual Standard_Boolean GenerateClass() const Standard_OVERRIDE;
+
+ //! Writes includes section of HXX
+ Standard_EXPORT Standard_Boolean writeIncludes(Standard_OStream& theOs, DataMapOfStringInteger& theDict) const;
+
+ //! Writes #include declarations for RW class
+ Standard_EXPORT void writeRWInclude(Standard_OStream& theOs, DataMapOfStringInteger& theDict) const;
+
+ //! Writes code for reading all fields
+ Standard_EXPORT Standard_Integer writeRWReadCode(
+ Standard_OStream& theOs,
+ const Standard_Integer theStart,
+ const Standard_Integer theOwn) const;
+
+ //! Writes code for writing all fields
+ Standard_EXPORT Standard_Integer writeRWWriteCode(
+ Standard_OStream& theOs,
+ const Standard_Integer theStart,
+ const Standard_Integer theOwn) const;
+
+ //! Writes code for adding shared entities to the graph
+ Standard_EXPORT Standard_Integer writeRWShareCode(
+ Standard_OStream& theOs,
+ const Standard_Integer theStart,
+ const Standard_Integer theOwn) const;
+
+ //! Writes arguments and code for method Init()
+ //! Mode identifyes what code is being written:
+ //! 0 - HXX declaration
+ //! 1 - CXX declaration
+ //! 2 - call (argument list)
+ //! 3 - implementation
+ //! 4 - call (argument list for RW)
+ Standard_EXPORT Standard_Integer makeInit(
+ Standard_OStream& theOs,
+ const Standard_Integer theShift,
+ const Standard_Integer theOwn,
+ const Standard_Integer theMode) const;
+
+ Handle(TColStd_HSequenceOfHAsciiString) mySupers;
+ Handle(Express_HSequenceOfEntity) myInherit;
+ Handle(Express_HSequenceOfField) myFields;
+ Standard_Boolean myisAbstract;
+};
+
+#endif // _Express_Entity_HeaderFile
--- /dev/null
+// 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 theName,
+ const Handle(TColStd_HSequenceOfHAsciiString) &theNames)
+ : Express_Item(theName), myNames(theNames)
+{
+}
+
+//=======================================================================
+//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 += CPPName()->String();
+
+ // Open HXX file
+ std::ofstream os(pack.Cat(".hxx").ToCString(), std::ios::out | std::ios::ate);
+
+ // write header
+ Express::WriteFileStamp(os);
+
+ // write defines
+ os << "#ifndef _" << CPPName()->ToCString() << "_HeaderFile" << std::endl;
+ os << "#define _" << CPPName()->ToCString() << "_HeaderFile" << std::endl;
+
+ os << std::endl << "enum " << CPPName()->ToCString() << std::endl;
+ os << "{" << 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 << " " << GetPackageName()->ToCString() << "_" << prefix->ToCString()
+ << myNames->Value(i)->ToCString();
+ }
+
+ os << std::endl << "};" << std::endl << std::endl;
+ os << "#endif // _" << CPPName()->ToCString() << "_HeaderFile" << std::endl;
+ os.close();
+
+ return Standard_False;
+}
--- /dev/null
+// 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 theName, const Handle(TColStd_HSequenceOfHAsciiString)& theNames);
+
+ //! Returns names of enumeration variants
+ Standard_EXPORT const Handle(TColStd_HSequenceOfHAsciiString)& Names() const;
+
+ //! Create HXX/CXX files from item
+ Standard_EXPORT virtual Standard_Boolean GenerateClass() const Standard_OVERRIDE;
+
+ DEFINE_STANDARD_RTTIEXT(Express_Enum,Express_Item)
+
+protected:
+
+private:
+
+ Handle(TColStd_HSequenceOfHAsciiString) myNames;
+
+};
+
+#endif // _Express_Enum_HeaderFile
--- /dev/null
+// 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 theName,
+ const Handle(Express_Type) &theType,
+ const Standard_Boolean theOpt)
+{
+ myName = new TCollection_HAsciiString(theName);
+ myType = theType;
+ myOpt = theOpt;
+}
+
+//=======================================================================
+//function : Express_Field
+//purpose :
+//=======================================================================
+
+Express_Field::Express_Field(
+ const Handle(TCollection_HAsciiString) &theName,
+ const Handle(Express_Type) &theType,
+ const Standard_Boolean theOpt)
+{
+ myName = theName;
+ myType = theType;
+ myOpt = theOpt;
+}
+
+//=======================================================================
+//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;
+}
--- /dev/null
+// 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 theName,
+ const Handle(Express_Type)& theType,
+ const Standard_Boolean theOpt);
+
+ //! Create object and initialize it
+ Standard_EXPORT Express_Field(
+ const Handle(TCollection_HAsciiString)& theName,
+ const Handle(Express_Type)& theType,
+ const Standard_Boolean theOpt);
+
+ //! 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
--- /dev/null
+// 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
--- /dev/null
+// 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
--- /dev/null
+// 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
--- /dev/null
+// 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");
+}
--- /dev/null
+// 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 Standard_OVERRIDE;
+
+ DEFINE_STANDARD_RTTIEXT(Express_Integer,Express_PredefinedType)
+
+protected:
+
+private:
+
+};
+
+#endif // _Express_Integer_HeaderFile
--- /dev/null
+// 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)
+
+Standard_Integer Express_Item::myIndex = -1;
+
+//=======================================================================
+//function : Express_Item
+//purpose :
+//=======================================================================
+
+Express_Item::Express_Item(const Standard_CString theName)
+{
+ myName = new TCollection_HAsciiString(theName);
+ 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) &theName)
+{
+ myName = theName;
+ 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 : SetPackageName
+//purpose :
+//=======================================================================
+
+void Express_Item::SetPackageName(const Handle(TCollection_HAsciiString) &thePack)
+{
+ myPack = thePack;
+}
+
+//=======================================================================
+//function : GetPackageName
+//purpose :
+//=======================================================================
+
+Handle(TCollection_HAsciiString) Express_Item::GetPackageName(const Standard_Boolean theAuto) const
+{
+ if (myPack.IsNull() && theAuto)
+ {
+ 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 theMark)
+{
+ myMark = theMark;
+}
+
+//=======================================================================
+//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) &thePack,
+ const Standard_Boolean theDefer)
+{
+ if (!GetPackageName().IsNull())
+ {
+ // issue a warning message if item from known package uses item from unknown package (StepStep)
+ if (thePack->String().IsDifferent("StepStep") && GetPackageName()->String().IsEqual("StepStep"))
+ {
+ std::cout << "Warning: item " << Name()->ToCString() << " has no package assigned, but used from package "
+ << thePack->ToCString() << std::endl;
+ }
+ return Standard_False;
+ }
+
+ // issue a warning message if type still does not have package assigned
+ if (thePack->String().IsDifferent("StepStep"))
+ {
+ std::cout << "Warning: item " << Name()->ToCString() << " has no package assigned, setting "
+ << thePack->ToCString() << std::endl;
+ }
+
+ SetPackageName(thePack);
+ SetMark(Standard_True);
+ if (theDefer)
+ {
+ 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)& theCateg)
+{
+ myCategory = theCateg;
+}
+
+//=======================================================================
+//function : Cartegory
+//purpose :
+//=======================================================================
+
+ Handle(TCollection_HAsciiString) Express_Item::Category() const
+{
+ return myCategory;
+}
+
+//=======================================================================
+//function : SetShortName
+//purpose :
+//=======================================================================
+
+ void Express_Item::SetShortName(const Handle(TCollection_HAsciiString)& theShName)
+{
+ myShortName = theShName;
+}
+
+//=======================================================================
+//function : ShortName
+//purpose :
+//=======================================================================
+
+ Handle(TCollection_HAsciiString) Express_Item::ShortName() const
+{
+ return myShortName;
+}
+//=======================================================================
+//function : SetCheckFlag
+//purpose :
+//=======================================================================
+
+ void Express_Item::SetCheckFlag(const Standard_Boolean theCheckFlag)
+{
+ myhasCheck = theCheckFlag;
+}
+
+//=======================================================================
+//function : CheckFlag
+//purpose :
+//=======================================================================
+
+ Standard_Boolean Express_Item::CheckFlag() const
+{
+ return myhasCheck;
+}
+
+//=======================================================================
+//function : SetFillSharedFlag
+//purpose :
+//=======================================================================
+
+ void Express_Item::SetFillSharedFlag(const Standard_Boolean theFillSharedFlag)
+{
+ myhasFillShared = theFillSharedFlag;
+}
+
+//=======================================================================
+//function : FillSharedFlag
+//purpose :
+//=======================================================================
+
+ Standard_Boolean Express_Item::FillSharedFlag() const
+{
+ return myhasFillShared;
+}
+
+ //=======================================================================
+ //function : SetIndex
+ //purpose :
+ //=======================================================================
+
+ void Express_Item::SetIndex(const Standard_Integer theIndex)
+ {
+ myIndex = theIndex;
+ }
+
+ //=======================================================================
+ //function : Index
+ //purpose :
+ //=======================================================================
+
+ Standard_Integer Express_Item::Index()
+ {
+ return myIndex;
+ }
+
--- /dev/null
+// 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 HXX
+//! and CXX files.
+class Express_Item : public Standard_Transient
+{
+public:
+
+ static Standard_Integer myIndex;
+
+ //! 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 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 theAuto = Standard_False) const;
+
+ //! Sets package name
+ Standard_EXPORT void SetPackageName (const Handle(TCollection_HAsciiString)& thePack) ;
+
+ //! 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 theMark) ;
+
+ //! General interface for creating HXX/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)& thePack,
+ const Standard_Boolean theDefer = Standard_False);
+
+ //! Set category for item
+ Standard_EXPORT void SetCategory (const Handle(TCollection_HAsciiString)& theCateg) ;
+
+ //! Get item category
+ Standard_EXPORT Handle(TCollection_HAsciiString) Category() const;
+
+ //! Set short name for item
+ Standard_EXPORT void SetShortName (const Handle(TCollection_HAsciiString)& theShName) ;
+
+ //! 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 theCheckFlag) ;
+
+ //! 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 theFillSharedFlag) ;
+
+ //! Get flag resposible for presence of method FillShared in the class
+ Standard_EXPORT Standard_Boolean FillSharedFlag() const;
+
+ //! Set start entity index
+ Standard_EXPORT static void SetIndex(const Standard_Integer theIndex);
+
+ //! Get current entity index
+ Standard_EXPORT static Standard_Integer Index();
+
+ 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
--- /dev/null
+// 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
--- /dev/null
+// 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 : 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;
+}
+
--- /dev/null
+// 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 Standard_OVERRIDE;
+
+ //! Return False
+ Standard_EXPORT virtual Standard_Boolean IsStandard() const Standard_OVERRIDE;
+
+ //! Return False
+ Standard_EXPORT virtual Standard_Boolean IsSimple() const Standard_OVERRIDE;
+
+ //! Return False
+ Standard_EXPORT virtual Standard_Boolean IsHandle() const Standard_OVERRIDE;
+
+ DEFINE_STANDARD_RTTIEXT(Express_Logical,Express_PredefinedType)
+
+protected:
+
+private:
+
+};
+
+#endif // _Express_Logical_HeaderFile
--- /dev/null
+// 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 theName)
+{
+ myName = new TCollection_HAsciiString(theName);
+}
+
+//=======================================================================
+//function : Express_NamedType
+//purpose :
+//=======================================================================
+
+Express_NamedType::Express_NamedType(const Handle(TCollection_HAsciiString)& theName)
+{
+ myName = theName;
+}
+
+//=======================================================================
+//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)& theItem)
+{
+ myItem = theItem;
+}
+
+//=======================================================================
+//function : CPPName
+//purpose :
+//=======================================================================
+
+Handle(TCollection_HAsciiString) Express_NamedType::CPPName() const
+{
+ return myItem->CPPName();
+}
+
+//=======================================================================
+//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)& thePack,
+ const Standard_Boolean theDefer) const
+{
+ return myItem->Use(thePack, theDefer);
+}
--- /dev/null
+// 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 theName);
+
+ //! Creates an object and initializes by name
+ Standard_EXPORT Express_NamedType(const Handle(TCollection_HAsciiString)& theName);
+
+ //! 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)& theItem) ;
+
+ //! Returns CPP-style name of the type
+ Standard_EXPORT virtual Handle(TCollection_HAsciiString) CPPName() const Standard_OVERRIDE;
+
+ //! Return True if type is defined in package Standard
+ Standard_EXPORT virtual Standard_Boolean IsStandard() const Standard_OVERRIDE;
+
+ //! Return True if type is simple (not a class)
+ Standard_EXPORT virtual Standard_Boolean IsSimple() const Standard_OVERRIDE;
+
+ //! Return True if type is inherited from Transient
+ Standard_EXPORT virtual Standard_Boolean IsHandle() const Standard_OVERRIDE;
+
+ //! 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)& thePack,
+ const Standard_Boolean theDefer = Standard_False) const Standard_OVERRIDE;
+
+ DEFINE_STANDARD_RTTIEXT(Express_NamedType,Express_Type)
+
+protected:
+
+private:
+
+ Handle(TCollection_HAsciiString) myName;
+ Handle(Express_Item) myItem;
+
+};
+
+#endif // _Express_NamedType_HeaderFile
--- /dev/null
+// 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
--- /dev/null
+// 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;
+}
+
--- /dev/null
+// 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 Standard_OVERRIDE;
+
+ DEFINE_STANDARD_RTTIEXT(Express_PredefinedType,Express_Type)
+
+protected:
+
+ //! Empty constructor
+ Standard_EXPORT Express_PredefinedType();
+
+private:
+
+};
+
+#endif // _Express_PredefinedType_HeaderFile
--- /dev/null
+// 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");
+}
--- /dev/null
+// 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 Standard_OVERRIDE;
+
+ DEFINE_STANDARD_RTTIEXT(Express_Real,Express_PredefinedType)
+
+protected:
+
+private:
+
+};
+
+#endif // _Express_Real_HeaderFile
--- /dev/null
+// 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 theName,
+ const Handle(TColStd_HSequenceOfHAsciiString) &theTypes)
+ : Express_Item(theName)
+{
+ myTypes = theTypes;
+}
+
+//=======================================================================
+//function : GenerateClass
+//purpose : dummy method
+//=======================================================================
+
+Standard_Boolean Express_Reference::GenerateClass() const
+{
+ return Standard_False;
+}
--- /dev/null
+// 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 theName,
+ const Handle(TColStd_HSequenceOfHAsciiString)& theTypes);
+
+ //! 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 Standard_OVERRIDE;
+
+ DEFINE_STANDARD_RTTIEXT(Express_Reference,Express_Item)
+
+protected:
+
+private:
+
+ Handle(TColStd_HSequenceOfHAsciiString) myTypes;
+ Handle(Express_HSequenceOfItem) myItems;
+
+};
+
+#endif // _Express_Reference_HeaderFile
--- /dev/null
+// 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 theName,
+ const Handle(Express_HSequenceOfItem)& theItems)
+{
+ myName = new TCollection_HAsciiString(theName);
+ myItems = theItems;
+ Prepare();
+}
+
+//=======================================================================
+//function : Express_Schema
+//purpose :
+//=======================================================================
+
+Express_Schema::Express_Schema(
+ const Handle(TCollection_HAsciiString)& theName,
+ const Handle(Express_HSequenceOfItem)& theItems)
+{
+ myName = theName;
+ myItems = theItems;
+ 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 theNum) const
+{
+ return myItems->Value(theNum);
+}
+
+//=======================================================================
+//function : Item
+//purpose :
+//=======================================================================
+
+Handle(Express_Item) Express_Schema::Item(
+ const Standard_CString theName,
+ const Standard_Boolean theSilent) const
+{
+ if (!myDict.IsBound(theName))
+ {
+ if (!theSilent)
+ {
+ std::cout << "Error: attempt to access unknown item by name " << theName << std::endl;
+ }
+ return 0;
+ }
+ return myDict.Find(theName);
+}
+
+//=======================================================================
+//function : Item
+//purpose :
+//=======================================================================
+
+Handle(Express_Item) Express_Schema::Item(const TCollection_AsciiString& theName) const
+{
+ return Item(theName.ToCString());
+}
+
+//=======================================================================
+//function : Item
+//purpose :
+//=======================================================================
+
+Handle(Express_Item) Express_Schema::Item(const Handle(TCollection_HAsciiString)& theName) const
+{
+ return Item(theName->ToCString());
+}
+
+//=======================================================================
+//function : nameToCasCade
+//purpose : auxilary for Prepare()
+// 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)& theName)
+{
+ if (theName.IsNull())
+ {
+ return;
+ }
+ for (Standard_Integer i = 1; i <= theName->Length(); i++)
+ {
+ if (theName->Value(i) == '_')
+ {
+ theName->Remove(i);
+ }
+ else if (i > 1)
+ {
+ continue;
+ }
+ theName->SetValue(i, UpperCase(theName->Value(i)));
+ }
+}
+
+//=======================================================================
+//function : nameToCasCade
+//purpose : auxilary for Prepare()
+// Convert names for Type object
+//=======================================================================
+static void nameToCasCade (const Handle(Express_Type)& theType)
+{
+ if (theType->IsKind(STANDARD_TYPE(Express_NamedType)))
+ {
+ const Handle(Express_NamedType) named = Handle(Express_NamedType)::DownCast(theType);
+ nameToCasCade(named->Name());
+ }
+ else if (theType->IsKind(STANDARD_TYPE(Express_ComplexType)))
+ {
+ const Handle(Express_ComplexType) complex = Handle(Express_ComplexType)::DownCast(theType);
+ nameToCasCade(complex->Type());
+ }
+}
+
+//=======================================================================
+//function : Prepare
+//purpose : 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)& theType) const
+{
+ if (theType->IsKind(STANDARD_TYPE(Express_NamedType)))
+ {
+ Handle(Express_NamedType) named = Handle(Express_NamedType)::DownCast(theType);
+ named->SetItem(Item(named->Name()));
+ }
+ else if (theType->IsKind(STANDARD_TYPE(Express_ComplexType)))
+ {
+ Handle(Express_ComplexType) complex = Handle(Express_ComplexType)::DownCast(theType);
+ PrepareType(complex->Type());
+ }
+}
--- /dev/null
+// 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 HXX/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 theName, const Handle(Express_HSequenceOfItem)& theItems);
+
+ //! Creates a schema with given name and given set of items
+ //! and calls Prepare()
+ Standard_EXPORT Express_Schema(
+ const Handle(TCollection_HAsciiString)& theName,
+ const Handle(Express_HSequenceOfItem)& theItems);
+
+ //! 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 theNum) const;
+
+ //! Returns item by name
+ Standard_EXPORT Handle(Express_Item) Item(
+ const Standard_CString theName,
+ const Standard_Boolean theSilent = Standard_False) const;
+
+ //! Returns item by name
+ Standard_EXPORT Handle(Express_Item) Item(const TCollection_AsciiString& theName) const;
+
+ //! Returns item by name
+ Standard_EXPORT Handle(Express_Item) Item(const Handle(TCollection_HAsciiString)& theName) 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)& theType) const;
+
+ Handle(TCollection_HAsciiString) myName;
+ Handle(Express_HSequenceOfItem) myItems;
+ Express_DataMapOfAsciiStringItem myDict;
+
+};
+
+#endif // _Express_Schema_HeaderFile
--- /dev/null
+// 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_ComplexType.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 theName,
+ const Handle(TColStd_HSequenceOfHAsciiString) &theNames)
+ : Express_Item(theName), myNames(theNames)
+{
+ 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(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))
+ || item->IsKind(STANDARD_TYPE(Express_Alias)) || item->IsKind(STANDARD_TYPE(Express_ComplexType)))
+ {
+ seqEntities->Append(i);
+ }
+ else
+ {
+ seqMember->Append(i);
+ }
+ }
+ 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 HXX
+
+ // Open HXX file
+ std::ofstream os(pack.Cat(".hxx").ToCString());
+
+ // write header
+ Express::WriteFileStamp(os);
+
+ // write start define
+ os << "#ifndef _" << CPPname->ToCString() << "_HeaderFile" << std::endl;
+ os << "#define _" << CPPname->ToCString() << "_HeaderFile" << std::endl;
+ os << std::endl;
+
+ // write common includes
+ os << "#include <Standard.hxx>" << std::endl;
+ os << "#include <Standard_DefineAlloc.hxx>" << std::endl;
+ os << "#include <Standard_Handle.hxx>" << std::endl;
+ os << "#include <StepData_SelectType.hxx>" << std::endl;
+ os << "#include <Standard_Integer.hxx>" << std::endl;
+ os << std::endl;
+
+ os << "class Standard_Transient;" << std::endl;
+ if (!seqMember->IsEmpty())
+ os << "class StepData_SelectMember;" << std::endl;
+
+ 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 << "class " << item->CPPName()->ToCString() << ";" << std::endl;
+ jj++;
+ }
+ os << std::endl;
+
+ // class declaration
+ os << "//! Representation of STEP SELECT type " << Name()->ToCString() << std::endl;
+ os << "class " << CPPname->ToCString() << " : public StepData_SelectType" << std::endl;
+ os << "{" << std::endl;
+ os << std::endl;
+ os << "public:" << std::endl;
+ os << std::endl;
+ os << " DEFINE_STANDARD_ALLOC" << std::endl;
+ os << std::endl;
+
+ // default constructor
+ os << " //! Empty constructor" << std::endl;
+ os << " Standard_EXPORT " << CPPname->ToCString() << "();" << std::endl;
+ os << std::endl;
+
+ // write common methods section
+ os << " //! Recognizes a kind of " << Name()->ToCString() << " select type" << std::endl;
+ for (Standard_Integer i = 1; i <= seqEntities->Length(); i++)
+ {
+ Standard_Integer ind = seqEntities->Value(i);
+ os << " //! -- " << i << " -> " << myNames->Value(ind)->ToCString() << std::endl;
+ }
+ os << " Standard_EXPORT Standard_Integer CaseNum (const Handle(Standard_Transient)& ent) const Standard_OVERRIDE;" << std::endl;
+ os << std::endl;
+
+ if(!seqMember->IsEmpty())
+ {
+ os << " //! Recognizes 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;
+ os << " Standard_EXPORT virtual Standard_Integer CaseMem (const Handle(StepData_SelectMember)& ent) const Standard_OVERRIDE;" << std::endl;
+ os << std::endl;
+
+ os << " //! Returns a new select member the type " << Name()->ToCString() << "Member" << std::endl;
+ os << " Standard_EXPORT virtual Handle(StepData_SelectMember) NewMember() const Standard_OVERRIDE;" << 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);
+ Handle(TCollection_HAsciiString) name = item->Name();
+ os << " //! Returns Value as " << name->ToCString() << " (or Null if another type)" << std::endl;
+ os << " Standard_EXPORT Handle(" << item->CPPName()->ToCString() << ") " <<
+ name->ToCString() << "() const;" << 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 Value for " << name->ToCString() << std::endl;
+ os << " Standard_EXPORT void Set" << name->ToCString()
+ << " (const " << item->CPPName()->ToCString() << " theVal);"<< std::endl;
+ os << std::endl;
+ os << " //! Returns Value as " << name->ToCString() << " (or Null if another type)" << std::endl;
+ os << " " << item->CPPName()->ToCString() << " " << name->ToCString() << "() const;" << std::endl;
+ os << std::endl;
+ }
+
+ // write end
+ os << "};" << std::endl;
+ os << "#endif // _" << CPPname->ToCString() << "_HeaderFile" << std::endl;
+ os.close();
+
+ //===============================
+ // Step 2: generating CXX
+
+ // Open CXX file
+ os.open(pack.Cat(".cxx").ToCString());
+
+ // write header
+ Express::WriteFileStamp(os);
+
+ // write include section
+ os << "#include <" << CPPname->ToCString() << ".hxx>" << std::endl;
+ if(!seqMember->IsEmpty())
+ {
+ os << "#include <" << CPPName()->ToCString() << "Member.hxx>"<< std::endl;
+ os << "#include <TCollection_HAsciiString.hxx>"<< std::endl;
+ }
+ for (Standard_Integer i = 1; i <= seqEntities->Length(); i++)
+ {
+ Standard_Integer ind = seqEntities->Value(i);
+ os << "#include <" << myItems->Value(ind)->CPPName()->ToCString() << ".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 (int 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)& theSeqMember) 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");
+ // 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 HXX
+
+ // Open HXX file
+ std::ofstream os ( pack.Cat ( ".hxx" ).ToCString() );
+ // write header
+ Express::WriteFileStamp ( os );
+
+ // write start define
+ os << "#ifndef _" << CPPname->ToCString() << "_HeaderFile" << std::endl;
+ os << "#define _" << CPPname->ToCString() << "_HeaderFile" << std::endl;
+ os << std::endl;
+
+ // includes
+ os << "#include <Standard.hxx>" << std::endl;
+ os << "#include <Standard_Type.hxx>" << std::endl;
+ os << "#include <Standard_Boolean.hxx>" << std::endl;
+ os << "#include <Standard_CString.hxx>" << std::endl;
+ os << "#include <Standard_Integer.hxx>" << std::endl;
+ os << "#include <StepData_SelectNamed.hxx>" << std::endl;
+ os << std::endl;
+ os << "DEFINE_STANDARD_HANDLE(" << CPPname->ToCString() << ", StepData_SelectNamed)" << std::endl;
+ os << std::endl;
+
+ // write start of declaration (inheritance)
+ os << " //! Representation of member for STEP SELECT type " << Name()->ToCString() << std::endl;
+ os << "class " << CPPname->ToCString() << " : public StepData_SelectNamed" << std::endl;
+ os << "{" << std::endl;
+ os << "public:" << std::endl;
+
+ // write methods
+ os << " //! Empty constructor" << std::endl;
+ os << " Standard_EXPORT " << CPPname->ToCString() << "();" << std::endl;
+ os << std::endl;
+
+ os << " //! Returns True if has name" << std::endl;
+ os << " Standard_EXPORT virtual Standard_Boolean HasName() const Standard_OVERRIDE;" << std::endl;
+ os << std::endl;
+ os << " //! Returns set name" << std::endl;
+ os << " Standard_EXPORT virtual Standard_CString Name() const Standard_OVERRIDE;" << std::endl;
+ os << std::endl;
+ os << " //! Set name" << std::endl;
+ os << " Standard_EXPORT virtual Standard_Boolean SetName(const Standard_CString name) Standard_OVERRIDE;"
+ << std::endl;
+ os << std::endl;
+ os << " //! Tells if the name of a SelectMember matches a given one;" << std::endl;
+ os << " Standard_EXPORT virtual Standard_Boolean Matches(const Standard_CString name) const Standard_OVERRIDE;"
+ << std::endl;
+ os << std::endl;
+
+ //write fields
+ os << "private:" << std::endl;
+ os << " Standard_Integer myCase;" << std::endl << std::endl;
+ // write end
+ os << "};" << std::endl;
+ os << "#endif // _" << CPPname->ToCString() << "_HeaderFile" << std::endl;
+ os.close();
+
+ //===============================
+ // Step 2: generating CXX
+ // Open CXX file
+ os.open(pack.Cat(".cxx").ToCString());
+
+ // write header
+ Express::WriteFileStamp(os);
+
+ // write include section
+ os << "#include <" << CPPname->ToCString() << ".hxx>" << 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 <= theSeqMember->Length(); i++)
+ {
+ Standard_Integer ind = theSeqMember->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 <= theSeqMember->Length(); i++)
+ {
+ Standard_Integer ind = theSeqMember->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;
+ }
--- /dev/null
+// 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 theName,
+ const Handle(TColStd_HSequenceOfHAsciiString)& theNames);
+
+ //! 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 HXX/CXX files from item
+ Standard_EXPORT virtual Standard_Boolean GenerateClass() const Standard_OVERRIDE;
+
+ DEFINE_STANDARD_RTTIEXT(Express_Select,Express_Item)
+
+protected:
+
+private:
+
+ Standard_EXPORT Standard_Boolean generateSelectMember(const Handle(TColStd_HSequenceOfInteger)& theSeqMember) const;
+
+ Handle(TColStd_HSequenceOfHAsciiString) myNames;
+ Handle(Express_HSequenceOfItem) myItems;
+
+};
+
+#endif // _Express_Select_HeaderFile
--- /dev/null
+// 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
--- /dev/null
+// 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
--- /dev/null
+// 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
--- /dev/null
+// 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
--- /dev/null
+// 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 : IsStandard
+//purpose :
+//=======================================================================
+
+Standard_Boolean Express_String::IsStandard() const
+{
+ return Standard_False;
+}
+
--- /dev/null
+// 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 Standard_OVERRIDE;
+
+ //! Returns False
+ Standard_EXPORT virtual Standard_Boolean IsStandard() const Standard_OVERRIDE;
+
+ DEFINE_STANDARD_RTTIEXT(Express_String,Express_PredefinedType)
+
+protected:
+
+private:
+
+};
+
+#endif // _Express_String_HeaderFile
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+
+ //! 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)& thePack,
+ const Standard_Boolean theDefer = Standard_False) const;
+
+ DEFINE_STANDARD_RTTIEXT(Express_Type,Standard_Transient)
+
+protected:
+
+ //! Empty constructor
+ Standard_EXPORT Express_Type();
+
+private:
+
+};
+
+#endif // _Express_Type_HeaderFile
--- /dev/null
+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
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.
[list both r XSMessage {} ] \
[list both r SHMessage {} ] \
[list both r XSTEPResource {} ] \
+ [list both x ExpToCasExe {} ] \
]
}
;#
--- /dev/null
+project(TKExpress)
+
+OCCT_INCLUDE_CMAKE_FILE (adm/cmake/occt_toolkit)
--- /dev/null
+EXTERNLIB
+PACKAGES