read_exchange_structure is a command-line program which reads a text STEP Part 21 data exchange file. In the default (no command line arguments) the program reads from standard input and exits silently, with return code 0. Options for interesting output is selected by command line arguments and can be one of:
The program returns with error code 1 if a syntax or semantic error is encountered reading either the Part 21 file or associated EXPRESS schema file. Other run-time errors result in error code 2. In either case, messages are written to standard error stream.
At run time the program reads the EXPRESS text file defining the schema which governs the data model exchanged in the Part 21 file. The schema file is specified either through a command line argument; or through a schema-catalog method. The schema-catalog method requires setting an environment variable and preparing an XML-format file specifying the locations of schema files.
This program is written in C++ and is compilable with the GCC 3.3 compiler. Source code and makefiles are included in this distribution. This program uses the open-source libxml2 (XML parser and toolkit) library and the Boost (C++ utilities) library, both of which must be installed prior to the configure-compile steps described below.
In a complete installation the program can be run from the command line; as an example
reads an exchange structure from standard input stream and writes Prolog clauses to the standard output stream. The full set of command line options is described in Appendix B.
This software is © 2006 by Vincent Marchetti (vmarchetti@kshell.com) and is distributed under the terms of the GNU public license.
The top directory of this distribution contains the shell script file configure. Running this shell script, with the working directory set to the top directory of the distribution, will generate a Makefile. Compilation and installation is configured by setting the values of several environment variables as described below prior to running the configure script. Running the make utility with various targets will compile and optionally install the program and associated support files.
The read_exchange_structure program is compiled with the execution from the command line of the following commands (with the top directory of the distribution as the working directory):
./configure make
After a successful compilation there will be a shell script read_exchange_structure.sh in the top directory which provides for a quick-start/test; running
will run the program reading an exchange file using the executable and EXPRESS schema in the distribution directories. The only schema provided in the distribution is for STEP AP 203. Note that the file locations are "hard-wired" in the read_exchange_structure.sh script, so it will cease working if files or directories are relocated.
The configured Makefile also provides two specific targets for installation; the install target combines both of these:
It is up to the user to set shell configuration files, etc. so that the appropriate value of EXPRESS_SCHEMA_CATALOG is set when the read_exchange_structure program is executed.
Setting the required environment variables can be accomplished by setting these values (and exporting them) from the command shell; or directly on the command line unsing the env command line executabe. The variables which control compilation, linking, and installation are:
options which must be passed to the gcc (or compatible compiler) which may be needed to include headers for the GNOME XML libraries. A typical value for this is
options passed to the linker to force linking to the appropriate libraries or archives containg GNOME XML library program code. A typical value setting the ‘-l’ flag, and specifying several other libraries required by the XML libraries, is
additional options to be passed to the C++ compiler to allow compiling with references to the Boost libraries. Typically these flags will specify the location of the Boost header files. This variable does not need to be defined if the Boost header files are installed in the standard compiler search path.
additional options to be passed to the linker to allow for linking with the Boost libraries. Typically these flags will specify the libraries to be dynamically linked as locations of the library files. If not defined, a reasonable guess is made for this variable, assuming the Boost libraries have been installed in a standard location.
the location into which the read_exchange_structure program will be installed when the make command is run with target install. If not specified, this variable will be set to $PREFIX/bin if variable PREFIX is defined, or ~/bin otherwise.
A location into which a folder express_schema will be copied. This folder will contain a schema_catalog file as well as EXPRESS schema files needed to read STEP files. The user will have to arrange having the environment variable EXPRESS_SCHEMA_CATALOG defined at the time the installed version of read_exchange_structure is executed. If not defined, an attempt will be made to deduce this variable from a defined EXPRESS_SCHEMA_CATALOG variable, or the choice $PREFIX/etc or ~/etc. In any case an existing directory located at $SCHEMA_DIR will not be overwritten or modified.
Some installations of the GNOME XML libraries include a shell script xml2-config which can automatically provide values for LIBXML2_CPPFLAGS and LIBXML2_LDLIBS. If these environment variables are not defined when configure is invoked, and if the xml2-config script is installed in the PATH of the environment, then the environment variable will be set using xml2-config.
A schema-catalog file is used to locate an EXPRESS schema for a Part 21 file at run time, based on the schema identifiers in the Part 21 file's HEADER section. A schema-catalog file matches the schema identifier label with a file system path. The comparison between the schema identifier in the Part 21 file and the label in the schema-catalog is case-insensitive. The path in the schema-catalog will be resolved by the program relative to the location of the schema-catalog file. A typical installation will put the schema-catalog file and the schema files in the same directory; then the path data may simply be the base-name of the schema file.
Example of a schema-catalog file, including embedded DTD: