View Issue Details

IDProjectCategoryView StatusLast Update
0031481Open CASCADEOCCT:Data Exchangepublic2022-03-24 17:15
Reporterabv Assigned Toika 
PrioritynormalSeverityintegration request 
Status assignedResolutionopen 
Target Version7.7.0 
Summary0031481: Data Exchange - provide parser of STEP EXPRESS schema for generation of new STEP entities
DescriptionExpToCas tool has been developed in 1999-2002 for generation of new classes in OCCT DE module, representing entities from STEP standard. It includes parser of EXPRESS schema and generator of CDL and CXX files that can be easily added to the OCCT STEP reader.

As new classes need to be added from time to time, it makes sense to integrate this tool to OCCT.
Steps To ReproduceNot possible
TagsNo tags attached.
Test case number

Relationships

related to 0031740 closedbugmaster Open CASCADE Configuration - recover support of Yacc and Lex generation 

Activities

git

2020-04-02 01:20

administrator   ~0091399

Branch CR31481 has been created by abv.

SHA-1: 3ac2d4ca774dada5905dd8f6ed62aa8c95c285be


Detailed log of new commits:

Author: abv
Date: Thu Apr 2 01:21:08 2020 +0300

    0031481: Data Exchange - provide parser of STEP EXPRESS schema for generation of new STEP entities
    
    Integration of ExpToCas tool ported to modern state of OCCT:
    - new package Express and toolkit TKExpress for EXPRESS data structures and OCCT class generator
    - executable ExpToCasExe including lax/yacc parsers, for parsing a Part 21 file and generating classes
    
    Off-topic: genproj.tcl is improved to deal correctly with FILES files containing CRLF end-of-lines

abv

2020-04-02 01:22

manager   ~0091400

I have updated old ExpToCas tool to build with current OCCT, and put it as a branch in OCCT code. What remains is to update code generator to produce modern code (at minimum, generate HXX instead of CDL).

git

2020-04-02 09:44

administrator   ~0091402

Branch CR31481 has been updated forcibly by abv.

SHA-1: 88b6bbb93dcb927aae800b87a6a8219964c2f23e

git

2020-04-02 13:55

administrator   ~0091412

Branch CR31481 has been updated by abv.

SHA-1: 48609845416c2b4b8429a498121185b7d5bed2d3


Detailed log of new commits:

Author: abv
Date: Thu Apr 2 13:56:31 2020 +0300

    // add missing files

git

2020-04-16 19:01

administrator   ~0091601

Branch CR31481 has been updated forcibly by ika.

SHA-1: f089155a022993f29b4fdbd3a8b25b89d9f41055

git

2020-04-20 18:07

administrator   ~0091688

Branch CR31481 has been updated forcibly by ika.

SHA-1: 447a80ecb5edc2fd108b9070d57aa88c01f216a8

git

2020-04-23 19:05

administrator   ~0091747

Branch CR31481 has been updated forcibly by ika.

SHA-1: 8a3d9d3eba4006680342a06d42924e28a4024ae4

git

2020-04-29 19:27

administrator   ~0091877

Branch CR31481 has been updated forcibly by ika.

SHA-1: ea4ec0eda802a9a3b0489877f44c273d32fdcbed

git

2020-04-30 21:29

administrator   ~0091921

Branch CR31481 has been updated by abv.

SHA-1: fe21a380c78295bba59c7a92c533d89f014de5f1


Detailed log of new commits:

Author: abv
Date: Thu Apr 30 21:29:57 2020 +0300

    Fix parser to avoid loosing fields after redefinition of inherited field (SELF\field = type;)

git

2020-05-11 21:35

administrator   ~0092067

Branch CR31481 has been updated by Igor.

SHA-1: 0580c8b11a5e15778971ac4e915212e8eabdfb7d


Detailed log of new commits:

Author: Igor Khozhanov
Date: Mon May 11 21:27:50 2020 +0300

    Fixed casting pointer to int error.
    Fixed /**/ comment inside comment warnings.
    Fixed converting string constant to 'char*' warning.

git

2020-08-20 15:54

administrator   ~0093564

Branch CR31481 has been updated forcibly by ika.

SHA-1: 9d659909bb074a370da3229f848cb5d779a7a325

git

2020-08-26 18:27

administrator   ~0093648

Branch CR31481 has been updated forcibly by ika.

SHA-1: 260f1b2e2e7fb8b6a572b64b950fd0f48dcf81dd

git

2020-08-27 14:46

administrator   ~0093669

Branch CR31481 has been updated forcibly by ika.

SHA-1: b307021a3da5f55b8fe52bb8d99e74d0adeba84e

git

2020-08-27 19:06

administrator   ~0093672

Branch CR31481 has been updated forcibly by ika.

SHA-1: eb0dbd1c84f25b961ab3ad0985cac22ed61e51fe

git

2020-08-28 15:38

administrator   ~0093698

Branch CR31481 has been updated forcibly by ika.

SHA-1: 1f02cd5f2139446df96b07cae5cdd9018e638278

git

2020-08-28 15:58

administrator   ~0093699

Branch CR31481_1 has been created by ika.

SHA-1: 98831117a4bf4dd66dc2efbaed0734f8fb4567fc


Detailed log of new commits:

Author: abv
Date: Thu Apr 2 01:21:08 2020 +0300

    0031481: Data Exchange - provide parser of STEP EXPRESS schema for generation of new STEP entities
    
    Integration of ExpToCas tool ported to modern state of OCCT:
    - new package Express and toolkit TKExpress for EXPRESS data structures and OCCT class generator
    - executable ExpToCasExe including lax/yacc parsers, for parsing a Part 21 file and generating classes
    
    Off-topic: genproj.tcl is improved to
    - deal correctly with FILES files containing CRLF end-of-lines
    - generate one project per executable unit (instead of one project per cxx file); note that this matches behaviour of CMake generator

ika

2020-08-28 16:00

developer   ~0093700

Dear ABV,

could you please review the CR31481_1 branch?

kgv

2020-09-06 11:59

developer   ~0094166

It would be nice formatting added files following OCCT Coding Rules / cleaning up code from redundant empty lines.

+  std::ofstream os ( pack.Cat ( ".hxx" ).ToCString() );

Shouldn't it be OSD_OpenStream()?

+++ b/src/TKExpress/EXTERNLIB
@@ -0,0 +1,2 @@
+TKernel
+CSF_TBB

CSF_TBB is really necessary for this toolkit?

abv

2020-11-23 21:58

manager   ~0097016

This patch shall be updated before integration:
- rebase on master
- regenerate flex scanner and bison parser using relevant CMake option (see 0031740 and 0027342), version to be used is win_flex_bison 2.5.23 (flex 2.6.4, bison 3.7.1), available in \\master\projects\occt-3rdparty\occt700products\win_flex_bison-2.5.23
- revise executables in ExpToCasExe: ones which are useful shall be preserved and documented, others better be removed
- revise scripts and resource files in ExpToCasExe to keep only ones that are useful. Note that we definitely need to have resource file describing distribution of STEP entities by packages in OCCT.
- It should be checked where we can keep files with STEP Express schemas (they are probably copyrighted and may not be distributed).

git

2020-11-27 13:50

administrator   ~0097108

Branch CR31481_1 has been updated forcibly by skl.

SHA-1: 4854f142ab0d3a2daedf1ade762ceda02bd5a1b1

git

2020-11-30 11:35

administrator   ~0097153

Branch CR31481_1 has been updated by skl.

SHA-1: 9b1dc148be73cae6982dadc829581bc71f93e18b


Detailed log of new commits:

Author: skl
Date: Mon Nov 30 11:35:00 2020 +0300

    0031481: Data Exchange - provide parser of STEP EXPRESS schema for generation of new STEP entities
    
    Changes for correspondence generated files to OCCT Code Rules.

git

2020-11-30 11:36

administrator   ~0097154

Branch CR31481_1 has been updated forcibly by skl.

SHA-1: 47d03fa5ebe82706506ecc76926e9443aa43f6e5

git

2020-11-30 15:33

administrator   ~0097172

Branch CR31481_1 has been updated by skl.

SHA-1: 7bc54d2e4eb535ada5b91eddf26380aadecbb1e2


Detailed log of new commits:

Author: skl
Date: Mon Nov 30 15:32:29 2020 +0300

    0031481: Data Exchange - provide parser of STEP EXPRESS schema for generation of new STEP entities
    
    Next part of formatting added files following OCCT Coding Rules.

git

2020-12-01 11:41

administrator   ~0097192

Branch CR31481_1 has been updated by skl.

SHA-1: 423a0239983e67b20743753326d8787f73fd5aa1


Detailed log of new commits:

Author: skl
Date: Tue Dec 1 11:40:51 2020 +0300

    0031481: Data Exchange - provide parser of STEP EXPRESS schema for generation of new STEP entities
    
    Next changes for correspondence generated files to OCCT Code Rules.

git

2020-12-02 10:36

administrator   ~0097232

Branch CR31481_1 has been updated by skl.

SHA-1: 44bb1c31502142599ecd1b88d37660671bbf2181


Detailed log of new commits:

Author: skl
Date: Wed Dec 2 10:36:38 2020 +0300

    0031481: Data Exchange - provide parser of STEP EXPRESS schema for generation of new STEP entities
    
    Add generation hxx files with declaration of arrays.
    If field is a HArray1 method for get length of array and method for get element of array by its index are generated.

git

2020-12-07 12:15

administrator   ~0097407

Branch CR31481_1 has been updated forcibly by skl.

SHA-1: cdb5b7e24e24d5f7f2d98ab28b01603fdb7508f4

git

2020-12-10 15:18

administrator   ~0097467

Branch CR31481_1 has been updated by skl.

SHA-1: 0654738fd9c700da1309b21171547503b1aadeb4


Detailed log of new commits:

Author: skl
Date: Mon Dec 7 12:54:59 2020 +0300

    0031481: Data Exchange - provide parser of STEP EXPRESS schema for generation of new STEP entities
    
    Changes for Lex and YACC.

git

2020-12-24 16:24

administrator   ~0097890

Branch CR31481_2 has been created by skl.

SHA-1: 16accbc55984196c5a141854132776d2c0dbc6ca


Detailed log of new commits:

Author: abv
Date: Thu Apr 2 01:21:08 2020 +0300

    0031481: Data Exchange - provide parser of STEP EXPRESS schema for generation of new STEP entities
    
    Integration of ExpToCas tool ported to modern state of OCCT:
    - new package Express and toolkit TKExpress for EXPRESS data structures and OCCT class generator
    - executable ExpToCasExe including lax/yacc parsers, for parsing a Part 21 file and generating classes
    
    Off-topic: genproj.tcl is improved to
    - deal correctly with FILES files containing CRLF end-of-lines
    - generate one project per executable unit (instead of one project per cxx file); note that this matches behaviour of CMake generator
    
    Formatting added files from package Express following OCCT Coding Rules
    
    Changes for correspondence generated files to OCCT Code Rules.
    
    Add generation hxx files with declaration of arrays.
    If field is a HArray1 method for get length of array and method for get element of array by its index are generated.
    
    Changes for generation parser from Lex and YACC files.
    
    Update description file readme.txt

git

2020-12-28 10:24

administrator   ~0097957

Branch CR31481_2 has been updated forcibly by skl.

SHA-1: d7397c85995845d12a4aae5817b295377475e8e8

git

2020-12-29 06:28

administrator   ~0097966

Branch CR31481_2 has been updated forcibly by skl.

SHA-1: 64427e8767282aa349860a4dda62204010eeb98b

git

2020-12-29 08:34

administrator   ~0097968

Branch CR31481_2 has been updated forcibly by skl.

SHA-1: 4421e59911a47f6bb1c5f8af9b8c45fafda19efa

git

2020-12-29 09:38

administrator   ~0097970

Branch CR31481_2 has been updated forcibly by skl.

SHA-1: e738f18c5fa7a3cbe5629f96214a4ea080afe806

git

2020-12-29 10:53

administrator   ~0097971

Branch CR31481_2 has been updated forcibly by skl.

SHA-1: efa4abef164854998bb51e033e1db33287c71c31

git

2020-12-29 11:28

administrator   ~0097972

Branch CR31481_2 has been updated forcibly by skl.

SHA-1: f90dec7ff382db9f78d4202fe76bc08959fcff5b

git

2020-12-31 11:16

administrator   ~0097996

Branch CR31481_2 has been updated forcibly by skl.

SHA-1: 2ae91a436f657c3f32c7d4f0e901cd34e3ab17d2

skl

2020-12-31 16:25

developer   ~0098001

lex and yacc files are updated.

szy

2021-10-25 10:17

manager   ~0104847

Last edited: 2021-10-27 11:25

Irina,
Could you review this issue, please...

git

2021-10-27 21:21

administrator   ~0104920

Branch CR31481_3 has been created by ika.

SHA-1: ca9e82c5e5c38123e73db1d47b72389014ca952f


Detailed log of new commits:

Author: ika
Date: Wed Oct 27 21:20:30 2021 +0300

    # Rebase onto current master and fix misprints.

Author: abv
Date: Thu Apr 2 01:21:08 2020 +0300

    0031481: Data Exchange - provide parser of STEP EXPRESS schema for generation of new STEP entities
    
    Integration of ExpToCas tool ported to modern state of OCCT:
    - new package Express and toolkit TKExpress for EXPRESS data structures and OCCT class generator
    - executable ExpToCasExe including lax/yacc parsers, for parsing a Part 21 file and generating classes
    
    Off-topic: genproj.tcl is improved to
    - deal correctly with FILES files containing CRLF end-of-lines
    - generate one project per executable unit (instead of one project per cxx file); note that this matches behaviour of CMake generator
    
    Formatting added files from package Express following OCCT Coding Rules
    
    Changes for correspondence generated files to OCCT Code Rules.
    
    Add generation hxx files with declaration of arrays.
    If field is a HArray1 method for get length of array and method for get element of array by its index are generated.
    
    Changes for generation parser from Lex and YACC files.
    
    Update description file readme.txt

git

2021-10-28 16:41

administrator   ~0104942

Branch CR31481_3 has been updated forcibly by ika.

SHA-1: be7c47a85721b1d67fe41cb04ec897d499a8fb2e

ika

2021-10-28 17:02

developer   ~0104943

The branch was updated:
- rebase onto current master;
- fix some misprints;
- update list of existed STEP entities;
- update readme.txt;
- complied in Jenkins, no warnings or test regression is found;
- make some manual testing, new entities are created successfully.

What will be good to do more:

1) Move "Off-topic" to the separated issue

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

2) old KGV remarks:

It would be nice formatting added files following OCCT Coding Rules / cleaning up code from redundant empty lines.

+ std::ofstream os ( pack.Cat ( ".hxx" ).ToCString() );

Shouldn't it be OSD_OpenStream()?

The remark about TBB is done.

3) Also I'm not sure that hardcoding of the path delimiter as a "/" is the best approach:

+ // 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();
in several files.

4) Some problems with schema parser:

a) Upper case in schema name (for AP242ed2 "SCHEMA Ap242_managed_model_based_3d_engineering_mim_LF") leads to fail of parser. (Add a tip to readme.txt, because it is not clear from the error message, but it is not a good solution)
b) BINARY keyword also leads to failure.

kgv

2021-10-28 17:26

developer   ~0104945

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

This should be pushed to dedicated issues.

+#ifdef _MSC_VER
+#pragma warning(push)
+#pragma warning (disable:4267)
+#pragma warning (disable:4706)
+#endif

Suppressing compiler warnings within the code should be complemented with details about these warnings and the reasons why they cannot be fixed.

+    name = s;
+    name[ind] = '\0';
+    Handle(Express_Item) item = schema->Item(name, Standard_True);
+    if (item.IsNull())

It is desired applying OCCT code style / name conventions to new code.

+  FILE *fin = fopen(argv[1], "rt");

OSD_FileSystem should be used instead of direct fopen().

+    std::cout << "Error: Cannot open " << argv[1] << std::endl;
+    return 0;

It is desired using messenger (e.g. Message::SendFail()) to colorize output of console tool and make it more readable.
Errors should also result in non-zero return code.

--- /dev/null
+++ b/src/ExpToCasExe/FILES
@@ -0,0 +1,7 @@
+exptocas.lex
+expltocas.yacc
+lex.exptocas.cxx
+exptocas.tab.hxx
+exptocas.tab.cxx
+ExpToCasExe.cxx

I have some doubts that "exptocas.tab.hxx" is expected to be a public header installed with OCCT SDK.
Consider renaming to .pxx.

--- /dev/null
+++ b/src/ExpToCasExe/occt_existed_step_entities.lst
@@ -0,0 +1,869 @@
+# Last update 27.10.2021
+#===============================================

It would be helpful to put a comment in the file if this file is automatically generated (how?) or manually filled.

--- /dev/null
+++ b/src/ExpToCasExe/readme.txt

I think that using Markdown syntax (ReadMe.md) would be preferred for this document.

+  END_ENTITY;  -- 10303-42: geometry_schema 
+
+
+
+

Redundant empty lines should be removed.

+  if (getenv("EXPTOCAS_TIME"))

OSD_Environment.

+  theOS << comm << " distribution for complete text of the license and disclaimer of any warranty." << std::endl;

std::endl looks awkward and unrelated here - please replace with \n.

+  theOS << comm << " Created by: " << aProcess.UserName().ToCString() << std::endl;
...
+  theOS << "//function : " << theName->ToCString() << std::endl;
...
+  std::cout << "ALIAS " << Name()->ToCString() << " = " << Type()->CPPName()->ToCString()

Redundant ToCString(); or could be replaced by String().

+  theOS << comm << " Copyright (c) Open CASCADE 2021" << std::endl;

As this function generates output, I guess it should be "2021-CurrentYear" (if this updates existing files) or "CurrentYear" (if this generates only new files) instead.

+  theOS << "//purpose  : " << std::endl;

Please do not generate trailing spaces.

+  Standard_EXPORT virtual   Handle(TCollection_HAsciiString) CPPName()  const Standard_OVERRIDE;

Unexpected spaces.

+  // create a package directory (if not yet exist)
+  OSD_Protection prot(OSD_RWXD, OSD_RWXD, OSD_RWXD, OSD_RWXD);

Using such file properties makes no sense.

+  std::ofstream os(pack.Cat(".hxx").ToCString());

OSD_FileSystem.

+ Standard_Boolean Express_Entity::AbstractFlag() const
+{
+  return myisAbstract;

Please inline.

+  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;

Please put an extra "private:" separator between class fields and methods.

+DEFINE_HSEQUENCE(Express_HSequenceOfField, Express_SequenceOfField)

Couldn't NCollection_Shared used instead of a legacy collection generation macros?

+class Express_Item : public Standard_Transient
+{
+public:
+
+  static Standard_Integer myIndex;

Is it really supposed to be public?
Description would be helpful in this case.

+++ b/src/Express/FILES
@@ -0,0 +1,48 @@
+Express.cxx

Does EXPRESS (data modeling language) exists outside STEP context?
Wouldn't it be better naming package and toolkit StepExpress?

Issue History

Date Modified Username Field Change
2020-04-02 01:16 abv New Issue
2020-04-02 01:16 abv Assigned To => gka
2020-04-02 01:20 git Note Added: 0091399
2020-04-02 01:21 abv Assigned To gka => ika
2020-04-02 01:22 abv Note Added: 0091400
2020-04-02 09:44 git Note Added: 0091402
2020-04-02 13:55 git Note Added: 0091412
2020-04-16 19:01 git Note Added: 0091601
2020-04-20 18:07 git Note Added: 0091688
2020-04-23 19:05 git Note Added: 0091747
2020-04-29 19:27 git Note Added: 0091877
2020-04-30 21:29 git Note Added: 0091921
2020-05-11 21:35 git Note Added: 0092067
2020-08-20 15:54 git Note Added: 0093564
2020-08-26 18:27 git Note Added: 0093648
2020-08-27 14:46 git Note Added: 0093669
2020-08-27 19:06 git Note Added: 0093672
2020-08-28 15:38 git Note Added: 0093698
2020-08-28 15:58 git Note Added: 0093699
2020-08-28 16:00 ika Note Added: 0093700
2020-08-28 16:00 ika Assigned To ika => abv
2020-08-28 16:00 ika Status new => resolved
2020-08-28 16:00 ika Steps to Reproduce Updated
2020-09-06 11:59 kgv Note Added: 0094166
2020-09-13 08:22 abv Relationship added related to 0031740
2020-09-24 16:15 abv Target Version 7.5.0 => 7.6.0
2020-11-23 21:58 abv Note Added: 0097016
2020-11-23 21:58 abv Assigned To abv => skl
2020-11-23 21:58 abv Status resolved => assigned
2020-11-27 13:50 git Note Added: 0097108
2020-11-30 11:35 git Note Added: 0097153
2020-11-30 11:36 git Note Added: 0097154
2020-11-30 15:33 git Note Added: 0097172
2020-12-01 11:41 git Note Added: 0097192
2020-12-02 10:36 git Note Added: 0097232
2020-12-07 12:15 git Note Added: 0097407
2020-12-10 15:18 git Note Added: 0097467
2020-12-24 16:24 git Note Added: 0097890
2020-12-28 10:24 git Note Added: 0097957
2020-12-29 06:28 git Note Added: 0097966
2020-12-29 08:34 git Note Added: 0097968
2020-12-29 09:38 git Note Added: 0097970
2020-12-29 10:53 git Note Added: 0097971
2020-12-29 11:28 git Note Added: 0097972
2020-12-31 11:16 git Note Added: 0097996
2020-12-31 16:25 skl Note Added: 0098001
2020-12-31 16:25 skl Assigned To skl => abv
2020-12-31 16:25 skl Status assigned => resolved
2021-10-25 10:17 szy Note Added: 0104847
2021-10-25 10:17 szy Assigned To abv => ika
2021-10-25 10:17 szy Status resolved => assigned
2021-10-25 10:22 szy Status assigned => resolved
2021-10-27 11:25 szy Note Edited: 0104847
2021-10-27 21:21 git Note Added: 0104920
2021-10-28 16:41 git Note Added: 0104942
2021-10-28 17:02 ika Note Added: 0104943
2021-10-28 17:02 ika Status resolved => assigned
2021-10-28 17:26 kgv Note Added: 0104945
2021-11-01 17:06 szy Target Version 7.6.0 => 7.7.0