mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-26 10:11:46 +00:00
express/run.bat: rewrite in Python
This commit is contained in:
@@ -258,5 +258,5 @@ if __name__ == "__main__":
|
|||||||
for output in sys.argv[2:]:
|
for output in sys.argv[2:]:
|
||||||
mdl = importlib.import_module(output)
|
mdl = importlib.import_module(output)
|
||||||
mdl.Generator(m).emit()
|
mdl.Generator(m).emit()
|
||||||
sys.stdout.write(m.schema.name)
|
print(m.schema.name)
|
||||||
""" % ("\n ".join(statements)))
|
""" % ("\n ".join(statements)))
|
||||||
|
|||||||
@@ -1,16 +0,0 @@
|
|||||||
import sys, fileinput
|
|
||||||
|
|
||||||
if sys.platform == "win32" and not hasattr(sys.stdout, "buffer"):
|
|
||||||
import os, msvcrt
|
|
||||||
|
|
||||||
msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY)
|
|
||||||
|
|
||||||
files = sys.argv[1:]
|
|
||||||
if files[0] == "-o":
|
|
||||||
b = open(files[1], "wb")
|
|
||||||
files = files[2:]
|
|
||||||
else:
|
|
||||||
b = getattr(sys.stdout, "buffer", sys.stdout)
|
|
||||||
|
|
||||||
for line in fileinput.input(files=files, mode="rb"):
|
|
||||||
b.write(line)
|
|
||||||
@@ -486,5 +486,4 @@ if __name__ == "__main__":
|
|||||||
for output in sys.argv[2:]:
|
for output in sys.argv[2:]:
|
||||||
mdl = importlib.import_module(output)
|
mdl = importlib.import_module(output)
|
||||||
mdl.Generator(m).emit()
|
mdl.Generator(m).emit()
|
||||||
sys.stdout.write(m.schema.name)
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,199 +0,0 @@
|
|||||||
@ECHO OFF
|
|
||||||
|
|
||||||
:: python bootstrap.py express.bnf > express_parser.py
|
|
||||||
|
|
||||||
IF EXIST IFC2X3_TC1.exp (
|
|
||||||
python express_parser.py IFC2X3_TC1.exp header implementation schema_class definitions
|
|
||||||
|
|
||||||
IF EXIST Ifc2x3-schema.cpp (
|
|
||||||
:: v0.6.0
|
|
||||||
python cat.py -o ..\..\..\ifcparse\schemas\Ifc2x3.cpp txt/header_ifc2x3.txt Ifc2x3.cpp
|
|
||||||
python cat.py -o ..\..\..\ifcparse\schemas\Ifc2x3.h txt/header_ifc2x3.txt Ifc2x3.h
|
|
||||||
python cat.py -o ..\..\..\ifcparse\schemas\Ifc2x3-schema.cpp txt/header_ifc2x3.txt Ifc2x3-schema.cpp
|
|
||||||
python cat.py -o ..\..\..\ifcparse\schemas\Ifc2x3-definitions.h txt/header_ifc2x3.txt Ifc2x3-definitions.h
|
|
||||||
) ELSE (
|
|
||||||
:: v0.5.0
|
|
||||||
python cat.py -o ..\..\..\ifcparse\schemas\Ifc2x3.cpp txt/header_ifc2x3.txt txt/ifndef_ifc4.txt Ifc2x3.cpp txt/endif.txt
|
|
||||||
python cat.py -o ..\..\..\ifcparse\schemas\Ifc2x3.h txt/header_ifc2x3.txt Ifc2x3.h
|
|
||||||
python cat.py -o ..\..\..\ifcparse\schemas\Ifc2x3enum.h txt/header_ifc2x3.txt Ifc2x3enum.h
|
|
||||||
python cat.py -o ..\..\..\ifcparse\schemas\Ifc2x3-latebound.cpp txt/header_ifc2x3.txt txt/ifndef_ifc4.txt Ifc2x3-latebound.cpp txt/endif.txt
|
|
||||||
python cat.py -o ..\..\..\ifcparse\schemas\Ifc2x3-latebound.h txt/header_ifc2x3.txt Ifc2x3-latebound.h
|
|
||||||
)
|
|
||||||
|
|
||||||
del *.cpp *.h
|
|
||||||
)
|
|
||||||
|
|
||||||
IF EXIST IFC4_ADD2TC1.exp (
|
|
||||||
python express_parser.py IFC4_ADD2TC1.exp header implementation schema_class definitions
|
|
||||||
|
|
||||||
IF EXIST Ifc4-schema.cpp (
|
|
||||||
:: v0.6.0
|
|
||||||
python cat.py -o ..\..\..\ifcparse\schemas\Ifc4.cpp txt/header_ifc4.txt Ifc4.cpp
|
|
||||||
python cat.py -o ..\..\..\ifcparse\schemas\Ifc4.h txt/header_ifc4.txt Ifc4.h
|
|
||||||
python cat.py -o ..\..\..\ifcparse\schemas\Ifc4-schema.cpp txt/header_ifc4.txt Ifc4-schema.cpp
|
|
||||||
python cat.py -o ..\..\..\ifcparse\schemas\Ifc4-definitions.h txt/header_ifc4.txt Ifc4-definitions.h
|
|
||||||
) ELSE (
|
|
||||||
:: v0.5.0
|
|
||||||
python cat.py -o ..\..\..\ifcparse\schemas\Ifc4.cpp txt/header_ifc4.txt txt/ifdef_ifc4.txt Ifc4.cpp txt/endif.txt
|
|
||||||
python cat.py -o ..\..\..\ifcparse\schemas\Ifc4.h txt/header_ifc4.txt Ifc4.h
|
|
||||||
python cat.py -o ..\..\..\ifcparse\schemas\Ifc4enum.h txt/header_ifc4.txt Ifc4enum.h
|
|
||||||
python cat.py -o ..\..\..\ifcparse\schemas\Ifc4-latebound.cpp txt/header_ifc4.txt txt/ifdef_ifc4.txt Ifc4-latebound.cpp txt/endif.txt
|
|
||||||
python cat.py -o ..\..\..\ifcparse\schemas\Ifc4-latebound.h txt/header_ifc4.txt Ifc4-latebound.h
|
|
||||||
)
|
|
||||||
|
|
||||||
del *.cpp *.h
|
|
||||||
)
|
|
||||||
|
|
||||||
IF EXIST IFC4x1.exp (
|
|
||||||
python express_parser.py IFC4x1.exp header implementation schema_class definitions
|
|
||||||
|
|
||||||
IF EXIST Ifc4x1-schema.cpp (
|
|
||||||
:: v0.6.0
|
|
||||||
python cat.py -o ..\..\..\ifcparse\schemas\Ifc4x1.cpp txt/header_ifc4x1.txt Ifc4x1.cpp
|
|
||||||
python cat.py -o ..\..\..\ifcparse\schemas\Ifc4x1.h txt/header_ifc4x1.txt Ifc4x1.h
|
|
||||||
python cat.py -o ..\..\..\ifcparse\schemas\Ifc4x1-schema.cpp txt/header_ifc4x1.txt Ifc4x1-schema.cpp
|
|
||||||
python cat.py -o ..\..\..\ifcparse\schemas\Ifc4x1-definitions.h txt/header_ifc4x1.txt Ifc4x1-definitions.h
|
|
||||||
)
|
|
||||||
|
|
||||||
del *.cpp *.h
|
|
||||||
)
|
|
||||||
|
|
||||||
IF EXIST IFC4x2.exp (
|
|
||||||
python express_parser.py IFC4x2.exp header implementation schema_class definitions
|
|
||||||
|
|
||||||
IF EXIST Ifc4x2-schema.cpp (
|
|
||||||
:: v0.6.0
|
|
||||||
python cat.py -o ..\..\..\ifcparse\schemas\Ifc4x2.cpp txt/header_ifc4x2.txt Ifc4x2.cpp
|
|
||||||
python cat.py -o ..\..\..\ifcparse\schemas\Ifc4x2.h txt/header_ifc4x2.txt Ifc4x2.h
|
|
||||||
python cat.py -o ..\..\..\ifcparse\schemas\Ifc4x2-schema.cpp txt/header_ifc4x2.txt Ifc4x2-schema.cpp
|
|
||||||
python cat.py -o ..\..\..\ifcparse\schemas\Ifc4x2-definitions.h txt/header_ifc4x2.txt Ifc4x2-definitions.h
|
|
||||||
)
|
|
||||||
|
|
||||||
del *.cpp *.h
|
|
||||||
)
|
|
||||||
|
|
||||||
IF EXIST IFC4x3_RC1.exp (
|
|
||||||
python express_parser.py IFC4x3_RC1.exp header implementation schema_class definitions
|
|
||||||
|
|
||||||
IF EXIST Ifc4x3_rc1-schema.cpp (
|
|
||||||
:: v0.6.0
|
|
||||||
python cat.py -o ..\..\..\ifcparse\schemas\Ifc4x3_rc1.cpp txt/header_ifc4x3_rc1.txt Ifc4x3_rc1.cpp
|
|
||||||
python cat.py -o ..\..\..\ifcparse\schemas\Ifc4x3_rc1.h txt/header_ifc4x3_rc1.txt Ifc4x3_rc1.h
|
|
||||||
python cat.py -o ..\..\..\ifcparse\schemas\Ifc4x3_rc1-schema.cpp txt/header_ifc4x3_rc1.txt Ifc4x3_rc1-schema.cpp
|
|
||||||
python cat.py -o ..\..\..\ifcparse\schemas\Ifc4x3_rc1-definitions.h txt/header_ifc4x3_rc1.txt Ifc4x3_rc1-definitions.h
|
|
||||||
)
|
|
||||||
|
|
||||||
del *.cpp *.h
|
|
||||||
)
|
|
||||||
|
|
||||||
IF EXIST IFC4x3_RC2.exp (
|
|
||||||
python express_parser.py IFC4x3_RC2.exp header implementation schema_class definitions
|
|
||||||
|
|
||||||
IF EXIST Ifc4x3_rc2-schema.cpp (
|
|
||||||
:: v0.6.0
|
|
||||||
python cat.py -o ..\..\..\ifcparse\schemas\Ifc4x3_rc2.cpp txt/header_ifc4x3_rc2.txt Ifc4x3_rc2.cpp
|
|
||||||
python cat.py -o ..\..\..\ifcparse\schemas\Ifc4x3_rc2.h txt/header_ifc4x3_rc2.txt Ifc4x3_rc2.h
|
|
||||||
python cat.py -o ..\..\..\ifcparse\schemas\Ifc4x3_rc2-schema.cpp txt/header_ifc4x3_rc2.txt Ifc4x3_rc2-schema.cpp
|
|
||||||
python cat.py -o ..\..\..\ifcparse\schemas\Ifc4x3_rc2-definitions.h txt/header_ifc4x3_rc2.txt Ifc4x3_rc2-definitions.h
|
|
||||||
)
|
|
||||||
|
|
||||||
del *.cpp *.h
|
|
||||||
)
|
|
||||||
|
|
||||||
IF EXIST IFC4x3_RC3.exp (
|
|
||||||
python express_parser.py IFC4x3_RC3.exp header implementation schema_class definitions
|
|
||||||
|
|
||||||
IF EXIST Ifc4x3_rc3-schema.cpp (
|
|
||||||
:: v0.6.0
|
|
||||||
python cat.py -o ..\..\..\ifcparse\schemas\Ifc4x3_rc3.cpp txt/header_ifc4x3_rc2.txt Ifc4x3_rc3.cpp
|
|
||||||
python cat.py -o ..\..\..\ifcparse\schemas\Ifc4x3_rc3.h txt/header_ifc4x3_rc2.txt Ifc4x3_rc3.h
|
|
||||||
python cat.py -o ..\..\..\ifcparse\schemas\Ifc4x3_rc3-schema.cpp txt/header_ifc4x3_rc2.txt Ifc4x3_rc3-schema.cpp
|
|
||||||
python cat.py -o ..\..\..\ifcparse\schemas\Ifc4x3_rc3-definitions.h txt/header_ifc4x3_rc2.txt Ifc4x3_rc3-definitions.h
|
|
||||||
)
|
|
||||||
|
|
||||||
del *.cpp *.h
|
|
||||||
)
|
|
||||||
|
|
||||||
IF EXIST IFC4x3_RC4.exp (
|
|
||||||
python express_parser.py IFC4x3_RC4.exp header implementation schema_class definitions
|
|
||||||
|
|
||||||
IF EXIST Ifc4x3_rc4-schema.cpp (
|
|
||||||
:: v0.6.0
|
|
||||||
python cat.py -o ..\..\..\ifcparse\schemas\Ifc4x3_rc4.cpp txt/header_ifc4x3_rc2.txt Ifc4x3_rc4.cpp
|
|
||||||
python cat.py -o ..\..\..\ifcparse\schemas\Ifc4x3_rc4.h txt/header_ifc4x3_rc2.txt Ifc4x3_rc4.h
|
|
||||||
python cat.py -o ..\..\..\ifcparse\schemas\Ifc4x3_rc4-schema.cpp txt/header_ifc4x3_rc2.txt Ifc4x3_rc4-schema.cpp
|
|
||||||
python cat.py -o ..\..\..\ifcparse\schemas\Ifc4x3_rc4-definitions.h txt/header_ifc4x3_rc2.txt Ifc4x3_rc4-definitions.h
|
|
||||||
)
|
|
||||||
|
|
||||||
del *.cpp *.h
|
|
||||||
)
|
|
||||||
|
|
||||||
IF EXIST IFC4X3.exp (
|
|
||||||
python express_parser.py IFC4X3.exp header implementation schema_class definitions
|
|
||||||
|
|
||||||
IF EXIST Ifc4x3-schema.cpp (
|
|
||||||
:: v0.6.0
|
|
||||||
python cat.py -o ..\..\..\ifcparse\schemas\Ifc4x3.cpp txt/header_ifc4x3_rc2.txt Ifc4x3.cpp
|
|
||||||
python cat.py -o ..\..\..\ifcparse\schemas\Ifc4x3.h txt/header_ifc4x3_rc2.txt Ifc4x3.h
|
|
||||||
python cat.py -o ..\..\..\ifcparse\schemas\Ifc4x3-schema.cpp txt/header_ifc4x3_rc2.txt Ifc4x3-schema.cpp
|
|
||||||
python cat.py -o ..\..\..\ifcparse\schemas\Ifc4x3-definitions.h txt/header_ifc4x3_rc2.txt Ifc4x3-definitions.h
|
|
||||||
)
|
|
||||||
|
|
||||||
del *.cpp *.h
|
|
||||||
)
|
|
||||||
|
|
||||||
IF EXIST IFC4X3_TC1.exp (
|
|
||||||
python express_parser.py IFC4X3_TC1.exp header implementation schema_class definitions
|
|
||||||
|
|
||||||
IF EXIST Ifc4x3_tc1-schema.cpp (
|
|
||||||
:: v0.6.0
|
|
||||||
python cat.py -o ..\..\..\ifcparse\schemas\Ifc4x3_tc1.cpp txt/header_ifc4x3_tc1.txt Ifc4x3_tc1.cpp
|
|
||||||
python cat.py -o ..\..\..\ifcparse\schemas\Ifc4x3_tc1.h txt/header_ifc4x3_tc1.txt Ifc4x3_tc1.h
|
|
||||||
python cat.py -o ..\..\..\ifcparse\schemas\Ifc4x3_tc1-schema.cpp txt/header_ifc4x3_tc1.txt Ifc4x3_tc1-schema.cpp
|
|
||||||
python cat.py -o ..\..\..\ifcparse\schemas\Ifc4x3_tc1-definitions.h txt/header_ifc4x3_tc1.txt Ifc4x3_tc1-definitions.h
|
|
||||||
)
|
|
||||||
|
|
||||||
del *.cpp *.h
|
|
||||||
)
|
|
||||||
|
|
||||||
IF EXIST IFC4X3_ADD1.exp (
|
|
||||||
python express_parser.py IFC4X3_ADD1.exp header implementation schema_class definitions
|
|
||||||
|
|
||||||
IF EXIST Ifc4x3_add1-schema.cpp (
|
|
||||||
:: v0.6.0
|
|
||||||
python cat.py -o ..\..\..\ifcparse\schemas\Ifc4x3_add1.cpp txt/header_ifc4x3_add1.txt Ifc4x3_add1.cpp
|
|
||||||
python cat.py -o ..\..\..\ifcparse\schemas\Ifc4x3_add1.h txt/header_ifc4x3_add1.txt Ifc4x3_add1.h
|
|
||||||
python cat.py -o ..\..\..\ifcparse\schemas\Ifc4x3_add1-schema.cpp txt/header_ifc4x3_add1.txt Ifc4x3_add1-schema.cpp
|
|
||||||
python cat.py -o ..\..\..\ifcparse\schemas\Ifc4x3_add1-definitions.h txt/header_ifc4x3_add1.txt Ifc4x3_add1-definitions.h
|
|
||||||
)
|
|
||||||
|
|
||||||
del *.cpp *.h
|
|
||||||
)
|
|
||||||
|
|
||||||
IF EXIST IFC4X3_ADD2.exp (
|
|
||||||
python express_parser.py IFC4X3_ADD2.exp header implementation schema_class definitions
|
|
||||||
|
|
||||||
IF EXIST Ifc4x3_add2-schema.cpp (
|
|
||||||
:: v0.6.0
|
|
||||||
python cat.py -o ..\..\..\ifcparse\schemas\Ifc4x3_add2.cpp txt/header_ifc4x3_add2.txt Ifc4x3_add2.cpp
|
|
||||||
python cat.py -o ..\..\..\ifcparse\schemas\Ifc4x3_add2.h txt/header_ifc4x3_add2.txt Ifc4x3_add2.h
|
|
||||||
python cat.py -o ..\..\..\ifcparse\schemas\Ifc4x3_add2-schema.cpp txt/header_ifc4x3_add2.txt Ifc4x3_add2-schema.cpp
|
|
||||||
python cat.py -o ..\..\..\ifcparse\schemas\Ifc4x3_add2-definitions.h txt/header_ifc4x3_add2.txt Ifc4x3_add2-definitions.h
|
|
||||||
)
|
|
||||||
|
|
||||||
del *.cpp *.h
|
|
||||||
)
|
|
||||||
|
|
||||||
IF EXIST header_schema.exp (
|
|
||||||
python express_parser.py header_schema.exp header implementation schema_class definitions
|
|
||||||
|
|
||||||
IF EXIST Header_section_schema-schema.cpp (
|
|
||||||
:: v0.6.0
|
|
||||||
python cat.py -o ..\..\..\ifcparse\schemas\Header_section_schema.cpp Header_section_schema.cpp
|
|
||||||
python cat.py -o ..\..\..\ifcparse\schemas\Header_section_schema.h Header_section_schema.h
|
|
||||||
python cat.py -o ..\..\..\ifcparse\schemas\Header_section_schema-schema.cpp Header_section_schema-schema.cpp
|
|
||||||
python cat.py -o ..\..\..\ifcparse\schemas\Header_section_schema-definitions.h Header_section_schema-definitions.h
|
|
||||||
)
|
|
||||||
|
|
||||||
del *.cpp *.h
|
|
||||||
)
|
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
/********************************************************************************
|
|
||||||
* *
|
|
||||||
* This file is part of IfcOpenShell. *
|
|
||||||
* *
|
|
||||||
* IfcOpenShell is free software: you can redistribute it and/or modify *
|
|
||||||
* it under the terms of the Lesser GNU General Public License as published by *
|
|
||||||
* the Free Software Foundation, either version 3.0 of the License, or *
|
|
||||||
* (at your option) any later version. *
|
|
||||||
* *
|
|
||||||
* IfcOpenShell 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 *
|
|
||||||
* Lesser GNU General Public License for more details. *
|
|
||||||
* *
|
|
||||||
* You should have received a copy of the Lesser GNU General Public License *
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
|
||||||
* *
|
|
||||||
********************************************************************************/
|
|
||||||
|
|
||||||
/********************************************************************************
|
|
||||||
* *
|
|
||||||
* This file has been generated from IFC2X3_TC1.exp. Do not make modifications *
|
|
||||||
* but instead modify the python script that has been used to generate this. *
|
|
||||||
* *
|
|
||||||
********************************************************************************/
|
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
/********************************************************************************
|
|
||||||
* *
|
|
||||||
* This file is part of IfcOpenShell. *
|
|
||||||
* *
|
|
||||||
* IfcOpenShell is free software: you can redistribute it and/or modify *
|
|
||||||
* it under the terms of the Lesser GNU General Public License as published by *
|
|
||||||
* the Free Software Foundation, either version 3.0 of the License, or *
|
|
||||||
* (at your option) any later version. *
|
|
||||||
* *
|
|
||||||
* IfcOpenShell 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 *
|
|
||||||
* Lesser GNU General Public License for more details. *
|
|
||||||
* *
|
|
||||||
* You should have received a copy of the Lesser GNU General Public License *
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
|
||||||
* *
|
|
||||||
********************************************************************************/
|
|
||||||
|
|
||||||
/********************************************************************************
|
|
||||||
* *
|
|
||||||
* This file has been generated from IFC4.exp. Do not make modifications *
|
|
||||||
* but instead modify the python script that has been used to generate this. *
|
|
||||||
* *
|
|
||||||
********************************************************************************/
|
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
/********************************************************************************
|
|
||||||
* *
|
|
||||||
* This file is part of IfcOpenShell. *
|
|
||||||
* *
|
|
||||||
* IfcOpenShell is free software: you can redistribute it and/or modify *
|
|
||||||
* it under the terms of the Lesser GNU General Public License as published by *
|
|
||||||
* the Free Software Foundation, either version 3.0 of the License, or *
|
|
||||||
* (at your option) any later version. *
|
|
||||||
* *
|
|
||||||
* IfcOpenShell 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 *
|
|
||||||
* Lesser GNU General Public License for more details. *
|
|
||||||
* *
|
|
||||||
* You should have received a copy of the Lesser GNU General Public License *
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
|
||||||
* *
|
|
||||||
********************************************************************************/
|
|
||||||
|
|
||||||
/********************************************************************************
|
|
||||||
* *
|
|
||||||
* This file has been generated from IFC4x1.exp. Do not make modifications *
|
|
||||||
* but instead modify the python script that has been used to generate this. *
|
|
||||||
* *
|
|
||||||
********************************************************************************/
|
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
/********************************************************************************
|
|
||||||
* *
|
|
||||||
* This file is part of IfcOpenShell. *
|
|
||||||
* *
|
|
||||||
* IfcOpenShell is free software: you can redistribute it and/or modify *
|
|
||||||
* it under the terms of the Lesser GNU General Public License as published by *
|
|
||||||
* the Free Software Foundation, either version 3.0 of the License, or *
|
|
||||||
* (at your option) any later version. *
|
|
||||||
* *
|
|
||||||
* IfcOpenShell 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 *
|
|
||||||
* Lesser GNU General Public License for more details. *
|
|
||||||
* *
|
|
||||||
* You should have received a copy of the Lesser GNU General Public License *
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
|
||||||
* *
|
|
||||||
********************************************************************************/
|
|
||||||
|
|
||||||
/********************************************************************************
|
|
||||||
* *
|
|
||||||
* This file has been generated from IFC4x2.exp. Do not make modifications *
|
|
||||||
* but instead modify the python script that has been used to generate this. *
|
|
||||||
* *
|
|
||||||
********************************************************************************/
|
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
/********************************************************************************
|
|
||||||
* *
|
|
||||||
* This file is part of IfcOpenShell. *
|
|
||||||
* *
|
|
||||||
* IfcOpenShell is free software: you can redistribute it and/or modify *
|
|
||||||
* it under the terms of the Lesser GNU General Public License as published by *
|
|
||||||
* the Free Software Foundation, either version 3.0 of the License, or *
|
|
||||||
* (at your option) any later version. *
|
|
||||||
* *
|
|
||||||
* IfcOpenShell 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 *
|
|
||||||
* Lesser GNU General Public License for more details. *
|
|
||||||
* *
|
|
||||||
* You should have received a copy of the Lesser GNU General Public License *
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
|
||||||
* *
|
|
||||||
********************************************************************************/
|
|
||||||
|
|
||||||
/********************************************************************************
|
|
||||||
* *
|
|
||||||
* This file has been generated from IFC4X3_ADD1.exp. Do not make modifications *
|
|
||||||
* but instead modify the python script that has been used to generate this. *
|
|
||||||
* *
|
|
||||||
********************************************************************************/
|
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
/********************************************************************************
|
|
||||||
* *
|
|
||||||
* This file is part of IfcOpenShell. *
|
|
||||||
* *
|
|
||||||
* IfcOpenShell is free software: you can redistribute it and/or modify *
|
|
||||||
* it under the terms of the Lesser GNU General Public License as published by *
|
|
||||||
* the Free Software Foundation, either version 3.0 of the License, or *
|
|
||||||
* (at your option) any later version. *
|
|
||||||
* *
|
|
||||||
* IfcOpenShell 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 *
|
|
||||||
* Lesser GNU General Public License for more details. *
|
|
||||||
* *
|
|
||||||
* You should have received a copy of the Lesser GNU General Public License *
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
|
||||||
* *
|
|
||||||
********************************************************************************/
|
|
||||||
|
|
||||||
/********************************************************************************
|
|
||||||
* *
|
|
||||||
* This file has been generated from IFC4X3_ADD2.exp. Do not make modifications *
|
|
||||||
* but instead modify the python script that has been used to generate this. *
|
|
||||||
* *
|
|
||||||
********************************************************************************/
|
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
/********************************************************************************
|
|
||||||
* *
|
|
||||||
* This file is part of IfcOpenShell. *
|
|
||||||
* *
|
|
||||||
* IfcOpenShell is free software: you can redistribute it and/or modify *
|
|
||||||
* it under the terms of the Lesser GNU General Public License as published by *
|
|
||||||
* the Free Software Foundation, either version 3.0 of the License, or *
|
|
||||||
* (at your option) any later version. *
|
|
||||||
* *
|
|
||||||
* IfcOpenShell 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 *
|
|
||||||
* Lesser GNU General Public License for more details. *
|
|
||||||
* *
|
|
||||||
* You should have received a copy of the Lesser GNU General Public License *
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
|
||||||
* *
|
|
||||||
********************************************************************************/
|
|
||||||
|
|
||||||
/********************************************************************************
|
|
||||||
* *
|
|
||||||
* This file has been generated from IFC4x3_RC1.exp. Do not make modifications *
|
|
||||||
* but instead modify the python script that has been used to generate this. *
|
|
||||||
* *
|
|
||||||
********************************************************************************/
|
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
/********************************************************************************
|
|
||||||
* *
|
|
||||||
* This file is part of IfcOpenShell. *
|
|
||||||
* *
|
|
||||||
* IfcOpenShell is free software: you can redistribute it and/or modify *
|
|
||||||
* it under the terms of the Lesser GNU General Public License as published by *
|
|
||||||
* the Free Software Foundation, either version 3.0 of the License, or *
|
|
||||||
* (at your option) any later version. *
|
|
||||||
* *
|
|
||||||
* IfcOpenShell 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 *
|
|
||||||
* Lesser GNU General Public License for more details. *
|
|
||||||
* *
|
|
||||||
* You should have received a copy of the Lesser GNU General Public License *
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
|
||||||
* *
|
|
||||||
********************************************************************************/
|
|
||||||
|
|
||||||
/********************************************************************************
|
|
||||||
* *
|
|
||||||
* This file has been generated from IFC4x3_RC2.exp. Do not make modifications *
|
|
||||||
* but instead modify the python script that has been used to generate this. *
|
|
||||||
* *
|
|
||||||
********************************************************************************/
|
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
/********************************************************************************
|
|
||||||
* *
|
|
||||||
* This file is part of IfcOpenShell. *
|
|
||||||
* *
|
|
||||||
* IfcOpenShell is free software: you can redistribute it and/or modify *
|
|
||||||
* it under the terms of the Lesser GNU General Public License as published by *
|
|
||||||
* the Free Software Foundation, either version 3.0 of the License, or *
|
|
||||||
* (at your option) any later version. *
|
|
||||||
* *
|
|
||||||
* IfcOpenShell 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 *
|
|
||||||
* Lesser GNU General Public License for more details. *
|
|
||||||
* *
|
|
||||||
* You should have received a copy of the Lesser GNU General Public License *
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
|
||||||
* *
|
|
||||||
********************************************************************************/
|
|
||||||
|
|
||||||
/********************************************************************************
|
|
||||||
* *
|
|
||||||
* This file has been generated from IFC4X3_TC1.exp. Do not make modifications *
|
|
||||||
* but instead modify the python script that has been used to generate this. *
|
|
||||||
* *
|
|
||||||
********************************************************************************/
|
|
||||||
+150
@@ -0,0 +1,150 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
# /// script
|
||||||
|
# ///
|
||||||
|
"""Generate C++ ifcparse schema sources from EXPRESS (.exp) definitions
|
||||||
|
and copy them into src/ifcparse/schemas.
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
python generate-exp-cpp.py
|
||||||
|
"""
|
||||||
|
|
||||||
|
import itertools
|
||||||
|
import shlex
|
||||||
|
import subprocess
|
||||||
|
import sys
|
||||||
|
from pathlib import Path
|
||||||
|
from typing import NamedTuple
|
||||||
|
|
||||||
|
|
||||||
|
class Schema(NamedTuple):
|
||||||
|
exp: str
|
||||||
|
schema_name: str
|
||||||
|
|
||||||
|
|
||||||
|
LICENSE_HEADER = """\
|
||||||
|
/********************************************************************************
|
||||||
|
* *
|
||||||
|
* This file is part of IfcOpenShell. *
|
||||||
|
* *
|
||||||
|
* IfcOpenShell is free software: you can redistribute it and/or modify *
|
||||||
|
* it under the terms of the Lesser GNU General Public License as published by *
|
||||||
|
* the Free Software Foundation, either version 3.0 of the License, or *
|
||||||
|
* (at your option) any later version. *
|
||||||
|
* *
|
||||||
|
* IfcOpenShell 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 *
|
||||||
|
* Lesser GNU General Public License for more details. *
|
||||||
|
* *
|
||||||
|
* You should have received a copy of the Lesser GNU General Public License *
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
||||||
|
* *
|
||||||
|
********************************************************************************/
|
||||||
|
|
||||||
|
/********************************************************************************
|
||||||
|
* *
|
||||||
|
{exp_line}
|
||||||
|
* but instead modify the python script that has been used to generate this. *
|
||||||
|
* *
|
||||||
|
********************************************************************************/
|
||||||
|
"""
|
||||||
|
|
||||||
|
BOX_WIDTH = 81
|
||||||
|
|
||||||
|
|
||||||
|
def generated_header(exp: str) -> str:
|
||||||
|
text = f" * This file has been generated from {exp}. Do not make modifications"
|
||||||
|
exp_line = text + " " * (BOX_WIDTH - len(text) - 1) + "*"
|
||||||
|
return LICENSE_HEADER.format(exp_line=exp_line)
|
||||||
|
|
||||||
|
|
||||||
|
class C:
|
||||||
|
RED = "\033[31m"
|
||||||
|
GREEN = "\033[32m"
|
||||||
|
RESET = "\033[0m"
|
||||||
|
|
||||||
|
|
||||||
|
SCRIPT_DIR = Path(__file__).resolve().parent
|
||||||
|
REPO_ROOT = Path(subprocess.check_output(["git", "rev-parse", "--show-toplevel"], cwd=SCRIPT_DIR, text=True).strip())
|
||||||
|
EXPRESS_DIR = REPO_ROOT / "src" / "ifcopenshell-python" / "ifcopenshell" / "express"
|
||||||
|
SCHEMAS_DIR = REPO_ROOT / "src" / "ifcparse" / "schemas"
|
||||||
|
|
||||||
|
|
||||||
|
def run(*cmd: str) -> None:
|
||||||
|
print("$", shlex.join(cmd))
|
||||||
|
subprocess.check_call(cmd, cwd=EXPRESS_DIR)
|
||||||
|
|
||||||
|
|
||||||
|
def write_generated_file(out: str, exp: str, *ins: str) -> None:
|
||||||
|
out_path = SCHEMAS_DIR / out
|
||||||
|
with out_path.open("w") as f_out:
|
||||||
|
f_out.write(generated_header(exp))
|
||||||
|
for fn in ins:
|
||||||
|
f_out.write((EXPRESS_DIR / fn).read_text())
|
||||||
|
print(f"{C.GREEN}wrote {out_path}{C.RESET}")
|
||||||
|
|
||||||
|
|
||||||
|
def cleanup() -> None:
|
||||||
|
for fn in itertools.chain(EXPRESS_DIR.glob("*.cpp"), EXPRESS_DIR.glob("*.h")):
|
||||||
|
fn.unlink()
|
||||||
|
|
||||||
|
|
||||||
|
def run_express_parser(exp: str) -> None:
|
||||||
|
run(
|
||||||
|
sys.executable,
|
||||||
|
"express_parser.py",
|
||||||
|
exp,
|
||||||
|
"header",
|
||||||
|
"implementation",
|
||||||
|
"schema_class",
|
||||||
|
"definitions",
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def generate_schema(schema: Schema) -> None:
|
||||||
|
if not (EXPRESS_DIR / schema.exp).exists():
|
||||||
|
print(f"{C.RED}skipping {schema.exp}, not found{C.RESET}")
|
||||||
|
return
|
||||||
|
|
||||||
|
run_express_parser(schema.exp)
|
||||||
|
|
||||||
|
name = schema.schema_name
|
||||||
|
write_generated_file(f"{name}.cpp", schema.exp, f"{name}.cpp")
|
||||||
|
write_generated_file(f"{name}.h", schema.exp, f"{name}.h")
|
||||||
|
write_generated_file(f"{name}-schema.cpp", schema.exp, f"{name}-schema.cpp")
|
||||||
|
write_generated_file(f"{name}-definitions.h", schema.exp, f"{name}-definitions.h")
|
||||||
|
|
||||||
|
cleanup()
|
||||||
|
|
||||||
|
|
||||||
|
SCHEMAS = [
|
||||||
|
Schema("IFC2X3_TC1.exp", "Ifc2x3"),
|
||||||
|
Schema("IFC4_ADD2_TC1.exp", "Ifc4"),
|
||||||
|
Schema("IFC4x1.exp", "Ifc4x1"),
|
||||||
|
Schema("IFC4x2.exp", "Ifc4x2"),
|
||||||
|
Schema("IFC4x3_RC1.exp", "Ifc4x3_rc1"),
|
||||||
|
Schema("IFC4x3_RC2.exp", "Ifc4x3_rc2"),
|
||||||
|
Schema("IFC4x3_RC3.exp", "Ifc4x3_rc3"),
|
||||||
|
Schema("IFC4x3_RC4.exp", "Ifc4x3_rc4"),
|
||||||
|
Schema("IFC4X3.exp", "Ifc4x3"),
|
||||||
|
Schema("IFC4X3_TC1.exp", "Ifc4x3_tc1"),
|
||||||
|
Schema("IFC4X3_ADD1.exp", "Ifc4x3_add1"),
|
||||||
|
Schema("IFC4X3_ADD2.exp", "Ifc4x3_add2"),
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
def main() -> None:
|
||||||
|
for schema in SCHEMAS:
|
||||||
|
generate_schema(schema)
|
||||||
|
|
||||||
|
run_express_parser("header_schema.exp")
|
||||||
|
|
||||||
|
write_generated_file("Header_section_schema.cpp", "header_schema.exp", "Header_section_schema.cpp")
|
||||||
|
write_generated_file("Header_section_schema.h", "header_schema.exp", "Header_section_schema.h")
|
||||||
|
write_generated_file("Header_section_schema-schema.cpp", "header_schema.exp", "Header_section_schema-schema.cpp")
|
||||||
|
|
||||||
|
cleanup()
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
||||||
Reference in New Issue
Block a user