Make a stab at merging master and brlcad. Not properly working yet, need to remove some files, etc.

This commit is contained in:
Cliff Yapp 2013-03-04 21:57:08 -05:00
commit 784363bf5f
184 changed files with 58378 additions and 70889 deletions

View file

@ -225,6 +225,7 @@ MARK_AS_ADVANCED(SCL_BUILD_EXPRESS_ONLY)
# scl_cf.h.in - scripts may need to append to the template, so
# it is read into memory initially.
SET(CONFIG_H_FILE ${SCL_BINARY_DIR}/include/scl_cf.h.in)
set_source_files_properties(${CONFIG_H_FILE} PROPERTIES GENERATED TRUE)
set(CMAKE_CURRENT_PROJECT SCL)
define_property(GLOBAL PROPERTY SCL_CONFIG_H_CONTENTS BRIEF_DOCS "config.h.in contents" FULL_DOCS "config.h.in contents for SCL project")
if(NOT COMMAND CONFIG_H_APPEND)
@ -239,14 +240,71 @@ endif(NOT COMMAND CONFIG_H_APPEND)
file(READ ${SCL_SOURCE_DIR}/include/scl_cf_cmake.h.in CONFIG_H_FILE_CONTENTS)
CONFIG_H_APPEND(SCL "${CONFIG_H_FILE_CONTENTS}")
# The Express parser uses the tools Perplex, RE2C and Lemon to generate code
# from higher level inputs. Depending on available tools and options, the
# SCL build can either re-generate code as part of the build, or use cached
# files that are ready for compilation.
#
# SCL_GENERATE_LEXER_PARSER is the "high level" control a user sets to determine
# how the SCL build will interact (or not) with these tools. AUTO (the
# default) means it will search for the necessary tools, and use them only if
# everything is found. If not, it will fall back to the cached versions. If
# this option is set to ON and the necessary tools are not found, the
# configure step will fail. If it is set to OFF, SCL will not even try to use
# the generators and will instead use the cached sources.
if(NOT SCL_GENERATE_LEXER_PARSER)
set(SCL_GENERATE_LEXER_PARSER "AUTO" CACHE STRING "Use Perplex, RE2C and Lemon to generate C source code.")
else(NOT SCL_GENERATE_LEXER_PARSER)
string(TOUPPER "${SCL_GENERATE_LEXER_PARSER}" SCL_GENERATE_LEXER_PARSER)
endif(NOT SCL_GENERATE_LEXER_PARSER)
set_property(CACHE SCL_GENERATE_LEXER_PARSER PROPERTY STRINGS AUTO ON OFF)
if (NOT "${SCL_GENERATE_LEXER_PARSER}" STREQUAL "AUTO" AND NOT "${SCL_GENERATE_LEXER_PARSER}" STREQUAL "ON" AND NOT "${SCL_GENERATE_LEXER_PARSER}" STREQUAL "OFF")
message(WARNING "Unknown value ${SCL_GENERATE_LEXER_PARSER} supplied for BRLCAD_WORD_SIZE - defaulting to AUTO")
message(WARNING "Valid options are AUTO, ON and OFF")
set(SCL_GENERATE_LEXER_PARSER "AUTO" CACHE STRING "Use Perplex, RE2C and Lemon to generate C source code.")
endif (NOT "${SCL_GENERATE_LEXER_PARSER}" STREQUAL "AUTO" AND NOT "${SCL_GENERATE_LEXER_PARSER}" STREQUAL "ON" AND NOT "${SCL_GENERATE_LEXER_PARSER}" STREQUAL "OFF")
# If the generators have not been turned off, we need to check for them
if(NOT "${SCL_GENERATE_LEXER_PARSER}" STREQUAL "OFF")
find_package(LEMON)
find_package(RE2C)
find_package(PERPLEX)
if(LEMON_EXECUTABLE AND LEMON_TEMPLATE AND PERPLEX_EXECUTABLE AND PERPLEX_TEMPLATE AND RE2C_EXECUTABLE)
# Templates may be anywhere - make sure we have a stable path if a relative
# path was specified at CMake time
get_filename_component(lemon_template_fpath "${LEMON_TEMPLATE}" ABSOLUTE)
if(NOT "${lemon_template_fpath}" STREQUAL "${LEMON_TEMPLATE}")
get_filename_component(LEMON_TEMPLATE "${CMAKE_BINARY_DIR}/${LEMON_TEMPLATE}" ABSOLUTE)
endif(NOT "${lemon_template_fpath}" STREQUAL "${LEMON_TEMPLATE}")
get_filename_component(perplex_template_fpath "${PERPLEX_TEMPLATE}" ABSOLUTE)
if(NOT "${perplex_template_fpath}" STREQUAL "${PERPLEX_TEMPLATE}")
get_filename_component(PERPLEX_TEMPLATE "${CMAKE_BINARY_DIR}/${PERPLEX_TEMPLATE}" ABSOLUTE)
endif(NOT "${perplex_template_fpath}" STREQUAL "${PERPLEX_TEMPLATE}")
if(NOT COMMAND LEMON_TARGET)
include(${SCL_CMAKE_DIR}/LEMON_Util.cmake)
endif(NOT COMMAND LEMON_TARGET)
if(NOT COMMAND PERPLEX_TARGET)
include(${SCL_CMAKE_DIR}/PERPLEX_Util.cmake)
endif(NOT COMMAND PERPLEX_TARGET)
set(SCL_GENERATE_LP_SOURCES 1)
else(LEMON_EXECUTABLE AND LEMON_TEMPLATE AND PERPLEX_EXECUTABLE AND PERPLEX_TEMPLATE AND RE2C_EXECUTABLE)
if("${SCL_GENERATE_LEXER_PARSER}" STREQUAL "ON")
message(FATAL_ERROR "\nSCL_GENERATE_LEXER_PARSER set to ON, but one or more components of the Perplex/RE2C/Lemon toolchain were not found.\n")
else("${SCL_GENERATE_LEXER_PARSER}" STREQUAL "ON")
set(SCL_GENERATE_LP_SOURCES 0)
endif("${SCL_GENERATE_LEXER_PARSER}" STREQUAL "ON")
endif(LEMON_EXECUTABLE AND LEMON_TEMPLATE AND PERPLEX_EXECUTABLE AND PERPLEX_TEMPLATE AND RE2C_EXECUTABLE)
else(NOT "${SCL_GENERATE_LEXER_PARSER}" STREQUAL "OFF")
set(SCL_GENERATE_LP_SOURCES 0)
endif(NOT "${SCL_GENERATE_LEXER_PARSER}" STREQUAL "OFF")
INCLUDE(CheckLibraryExists)
INCLUDE(CheckIncludeFile)
INCLUDE(CheckFunctionExists)
INCLUDE(CheckTypeSize)
INCLUDE(CMakePushCheckState)
INCLUDE(CheckCXXSourceRuns)
INCLUDE(${SCL_CMAKE_DIR}/FindLEX.cmake)
INCLUDE(${SCL_CMAKE_DIR}/FindYACC.cmake)
CHECK_INCLUDE_FILE(ndir.h HAVE_NDIR_H)
CHECK_INCLUDE_FILE(stdarg.h HAVE_STDARG_H)

6
NEWS
View file

@ -190,7 +190,7 @@ types, entities, and attributes.
- Fixed a bug in the casting functions for the classes handling
instances of SELECT TYPEs in EXPRESS.
e.g.
SdaiMeasure_value::operator SCLP23(Real)()
SdaiMeasure_value::operator SDAI_Real)(
{
// was missing stmts such as these...
if( CurrentUnderlyingType () == config_control_designt_area_measure )
@ -307,10 +307,10 @@ classes is what allows for the flexibility in dealing with problem
areas when using SCL with other software.
An example of a name change and macro use: sdaiString has now become
SCLP23(String) which could translate to SDAI::String or SDAI_String
SDAI_String which could translate to SDAI::String or SDAI_String
(depending on whether you use the SDAI namespace or not) or any other
namespace or prefix as is necessary. To change the SDAI namespace name
or prefix name the macro definition for SCLP23() could be changed in
or prefix name the macro definition for SDAI_ could be changed in
the sclprefixes.h file.
The early bound access functions that are generated by fedex_plus from

74
cmake/FindLEMON.cmake Normal file
View file

@ -0,0 +1,74 @@
#
# - Find lemon executable and provides macros to generate custom build rules
# The module defines the following variables
#
# LEMON_EXECUTABLE - path to the lemon program
# LEMON_TEMPLATE - location of the lemon template file
#=============================================================================
# F I N D L E M O N . C M A K E
#
# Originally based off of FindBISON.cmake from Kitware's CMake distribution
#
# Copyright (c) 2010-2012 United States Government as represented by
# the U.S. Army Research Laboratory.
# Copyright 2009 Kitware, Inc.
# Copyright 2006 Tristan Carel
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# * 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.
#
# * The names of the authors may not be used to endorse or promote
# products derived from this software without specific prior written
# permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#=============================================================================
find_program(LEMON_EXECUTABLE lemon DOC "path to the lemon executable")
mark_as_advanced(LEMON_EXECUTABLE)
if(LEMON_EXECUTABLE AND NOT LEMON_TEMPLATE)
get_filename_component(lemon_path ${LEMON_EXECUTABLE} PATH)
if(lemon_path)
set(LEMON_TEMPLATE "")
if(EXISTS ${lemon_path}/lempar.c)
set(LEMON_TEMPLATE "${lemon_path}/lempar.c")
endif(EXISTS ${lemon_path}/lempar.c)
if(EXISTS /usr/share/lemon/lempar.c)
set(LEMON_TEMPLATE "/usr/share/lemon/lempar.c")
endif(EXISTS /usr/share/lemon/lempar.c)
endif(lemon_path)
endif(LEMON_EXECUTABLE AND NOT LEMON_TEMPLATE)
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(LEMON DEFAULT_MSG LEMON_EXECUTABLE LEMON_TEMPLATE)
mark_as_advanced(LEMON_TEMPLATE)
#============================================================
# FindLEMON.cmake ends here
# Local Variables:
# tab-width: 8
# mode: cmake
# indent-tabs-mode: t
# End:
# ex: shiftwidth=2 tabstop=8

79
cmake/FindPERPLEX.cmake Normal file
View file

@ -0,0 +1,79 @@
#
# - Find perplex executable and provides macros to generate custom build rules
# The module defines the following variables
#
# PERPLEX_EXECUTABLE - path to the perplex program
# PERPLEX_TEMPLATE - location of the perplex template file
#=============================================================================
# F I N D P E R P L E X . C M A K E
#
# Originally based off of FindBISON.cmake from Kitware's CMake distribution
#
# Copyright (c) 2010-2012 United States Government as represented by
# the U.S. Army Research Laboratory.
# Copyright 2009 Kitware, Inc.
# Copyright 2006 Tristan Carel
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# * 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.
#
# * The names of the authors may not be used to endorse or promote
# products derived from this software without specific prior written
# permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#=============================================================================
find_program(PERPLEX_EXECUTABLE perplex DOC "path to the perplex executable")
mark_as_advanced(PERPLEX_EXECUTABLE)
if(PERPLEX_EXECUTABLE AND NOT PERPLEX_TEMPLATE)
get_filename_component(perplex_path ${PERPLEX_EXECUTABLE} PATH)
if(perplex_path)
set(PERPLEX_TEMPLATE "")
if(EXISTS ${perplex_path}/../share/perplex/perplex_template.c)
get_filename_component(perplex_template_path "${perplex_path}/../share/perplex/perplex_template.c" ABSOLUTE)
set(PERPLEX_TEMPLATE "${perplex_template_path}")
endif(EXISTS ${perplex_path}/../share/perplex/perplex_template.c)
if(EXISTS ${perplex_path}/../share/perplex_template.c AND NOT PERPLEX_TEMPLATE)
get_filename_component(perplex_template_path "${perplex_path}/../share/perplex_template.c" ABSOLUTE)
set(PERPLEX_TEMPLATE "${perplex_template_path}")
endif(EXISTS ${perplex_path}/../share/perplex_template.c AND NOT PERPLEX_TEMPLATE)
endif(perplex_path)
if(EXISTS /usr/share/perplex/perplex_template.c AND NOT PERPLEX_TEMPLATE)
set(PERPLEX_TEMPLATE "/usr/share/perplex/perplex_template.c")
endif(EXISTS /usr/share/perplex/perplex_template.c AND NOT PERPLEX_TEMPLATE)
endif(PERPLEX_EXECUTABLE AND NOT PERPLEX_TEMPLATE)
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(PERPLEX DEFAULT_MSG PERPLEX_EXECUTABLE PERPLEX_TEMPLATE)
mark_as_advanced(PERPLEX_TEMPLATE)
#============================================================
# FindPERPLEX.cmake ends here
# Local Variables:
# tab-width: 8
# mode: cmake
# indent-tabs-mode: t
# End:
# ex: shiftwidth=2 tabstop=8

10
cmake/FindRE2C.cmake Normal file
View file

@ -0,0 +1,10 @@
# The module defines the following variables:
# RE2C_EXECUTABLE - the path to the re2c executable
#
#=============================================================================
find_program(RE2C_EXECUTABLE re2c DOC "path to the re2c executable")
mark_as_advanced(RE2C_EXECUTABLE)
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(RE2C DEFAULT_MSG RE2C_EXECUTABLE)

View file

@ -0,0 +1,89 @@
# Utility routines for managing generated files with CMake
macro(MD5 filename md5sum)
file(READ "${filename}" RAW_MD5_FILE)
string(REGEX REPLACE "\r?\n" "" STRIPPED_MD5_FILE "${RAW_MD5_FILE}")
file(WRITE ${CMAKE_BINARY_DIR}/CMakeTmp/md5_file "${STRIPPED_MD5_FILE}")
execute_process(COMMAND ${CMAKE_COMMAND} -E md5sum ${CMAKE_BINARY_DIR}/CMakeTmp/md5_file OUTPUT_VARIABLE md5string)
file(REMOVE ${CMAKE_BINARY_DIR}/CMakeTmp/md5_file)
string(REPLACE " ${CMAKE_BINARY_DIR}/CMakeTmp/md5_file" "" md5string "${md5string}")
string(STRIP "${md5string}" ${md5sum})
endmacro(MD5)
macro(FILEVAR filename var)
string(REGEX REPLACE "[^a-zA-Z0-9]" "_" ${var} ${filename})
endmacro(FILEVAR)
macro(VERIFY_FILES filelist warn resultvar)
set(${resultvar} 1)
foreach(fileitem ${filelist})
# Deal with absolute and relative paths a bit differently
get_filename_component(ITEM_ABS_PATH "${fileitem}" ABSOLUTE)
if("${fileitem}" STREQUAL "${ITEM_ABS_PATH}")
set(filefullname "${fileitem}")
else("${fileitem}" STREQUAL "${ITEM_ABS_PATH}")
set(filefullname "${CURRENT_SOURCE_DIR}/${fileitem}")
endif("${fileitem}" STREQUAL "${ITEM_ABS_PATH}")
get_filename_component(filename "${fileitem}" NAME)
# Got filename components sorted - proceed
if(NOT EXISTS ${filefullname})
message(FATAL_ERROR "Attempted to verify non-existant file ${filefullname}")
endif(NOT EXISTS ${filefullname})
FILEVAR(${filename} filevar)
if(NOT baseline_${filevar}_md5)
message(FATAL_ERROR "No baseline MD5 available for ${filename} - baseline_${filevar}_md5 is not defined")
endif(NOT baseline_${filevar}_md5)
MD5(${filefullname} ${filevar}_md5)
if(NOT "${${filevar}_md5}" STREQUAL "${baseline_${filevar}_md5}")
if("${warn}" STREQUAL "1")
message("\n${filename} differs from baseline: baseline md5 hash is ${baseline_${filevar}_md5} and current hash is ${${filevar}_md5}\n")
endif("${warn}" STREQUAL "1")
set(${resultvar} 0)
else(NOT "${${filevar}_md5}" STREQUAL "${baseline_${filevar}_md5}")
if("${warn}" STREQUAL "1")
message("${fileitem} OK")
endif("${warn}" STREQUAL "1")
endif(NOT "${${filevar}_md5}" STREQUAL "${baseline_${filevar}_md5}")
endforeach(fileitem ${filelist})
endmacro(VERIFY_FILES filelist resultvar)
macro(WRITE_MD5_SUMS filelist outfile)
foreach(fileitem ${filelist})
# Deal with absolute and relative paths a bit differently
get_filename_component(ITEM_ABS_PATH "${fileitem}" ABSOLUTE)
if("${fileitem}" STREQUAL "${ITEM_ABS_PATH}")
set(filefullname "${fileitem}")
else("${fileitem}" STREQUAL "${ITEM_ABS_PATH}")
set(filefullname "${CURRENT_SOURCE_DIR}/${fileitem}")
endif("${fileitem}" STREQUAL "${ITEM_ABS_PATH}")
get_filename_component(filename "${fileitem}" NAME)
# Got filename components sorted - proceed
if(NOT EXISTS ${filefullname})
message(FATAL_ERROR "Attempted to get MD5 sum of non-existant file ${filefullname}")
endif(NOT EXISTS ${filefullname})
FILEVAR(${filename} filevar)
MD5(${filefullname} ${filevar}_md5)
file(APPEND ${outfile} "set(baseline_${filevar}_md5 ${${filevar}_md5})\n")
endforeach(fileitem ${filelist})
endmacro(WRITE_MD5_SUMS)
macro(GET_GENERATOR_EXEC_VERSIONS)
# Read lemon version
execute_process(COMMAND ${LEMON_EXECUTABLE} -x OUTPUT_VARIABLE lemon_version)
string(REPLACE "Lemon version " "" lemon_version "${lemon_version}")
string(STRIP "${lemon_version}" lemon_version)
# Read re2c version
execute_process(COMMAND ${RE2C_EXECUTABLE} -V OUTPUT_VARIABLE re2c_version)
string(STRIP "${re2c_version}" re2c_version)
# Read perplex version
execute_process(COMMAND ${PERPLEX_EXECUTABLE} -v OUTPUT_VARIABLE perplex_version)
string(STRIP "${perplex_version}" perplex_version)
endmacro(GET_GENERATOR_EXEC_VERSIONS)
# Local Variables:
# tab-width: 8
# mode: cmake
# indent-tabs-mode: t
# End:
# ex: shiftwidth=2 tabstop=8

146
cmake/LEMON_Util.cmake Normal file
View file

@ -0,0 +1,146 @@
# Defines the macro
# LEMON_TARGET(<Name> <LemonInput> <LemonSource> <LemonHeader>
# [<ArgString>])
# which will create a custom rule to generate a parser. <LemonInput> is
# the path to a lemon file. <LemonSource> is the desired name for the
# generated source file. <LemonHeader> is the desired name for the
# generated header which contains the token list. Anything in the optional
# <ArgString> parameter is appended to the lemon command line.
#
# ====================================================================
# Example:
#
# find_package(LEMON)
# LEMON_TARGET(MyParser parser.y parser.c parser.h)
# add_executable(Foo main.cpp ${LEMON_MyParser_OUTPUTS})
# ====================================================================
#
#=============================================================================
#
# Originally based off of FindBISON.cmake from Kitware's CMake distribution
#
# Copyright (c) 2010-2012 United States Government as represented by
# the U.S. Army Research Laboratory.
# Copyright 2009 Kitware, Inc.
# Copyright 2006 Tristan Carel
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# * 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.
#
# * The names of the authors may not be used to endorse or promote
# products derived from this software without specific prior written
# permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#=============================================================================
#============================================================
# LEMON_TARGET (public macro)
#============================================================
#
macro(LEMON_TARGET Name LemonInput LemonSource LemonHeader)
if(NOT ${ARGC} EQUAL 4 AND NOT ${ARGC} EQUAL 5)
message(SEND_ERROR "Usage")
else()
get_filename_component(LemonInputFull ${LemonInput} ABSOLUTE)
get_filename_component(LemonSourceFull ${LemonSource} ABSOLUTE)
get_filename_component(LemonHeaderFull ${LemonHeader} ABSOLUTE)
if(NOT ${LemonInput} STREQUAL ${LemonInputFull})
set(LEMON_${Name}_INPUT "${CMAKE_CURRENT_BINARY_DIR}/${LemonInput}")
else(NOT ${LemonInput} STREQUAL ${LemonInputFull})
set(LEMON_${Name}_INPUT "${LemonInput}")
endif(NOT ${LemonInput} STREQUAL ${LemonInputFull})
if(NOT ${LemonSource} STREQUAL ${LemonSourceFull})
set(LEMON_${Name}_OUTPUT_SOURCE "${CMAKE_CURRENT_BINARY_DIR}/${LemonSource}")
else(NOT ${LemonSource} STREQUAL ${LemonSourceFull})
set(LEMON_${Name}_OUTPUT_SOURCE "${LemonSource}")
endif(NOT ${LemonSource} STREQUAL ${LemonSourceFull})
if(NOT ${LemonHeader} STREQUAL ${LemonHeaderFull})
set(LEMON_${Name}_OUTPUT_HEADER "${CMAKE_CURRENT_BINARY_DIR}/${LemonHeader}")
else(NOT ${LemonHeader} STREQUAL ${LemonHeaderFull})
set(LEMON_${Name}_OUTPUT_HEADER "${LemonHeader}")
endif(NOT ${LemonHeader} STREQUAL ${LemonHeaderFull})
set(LEMON_${Name}_EXTRA_ARGS "${ARGV4}")
# get input name minus path
get_filename_component(INPUT_NAME "${LemonInput}" NAME)
set(LEMON_BIN_INPUT ${CMAKE_CURRENT_BINARY_DIR}/${INPUT_NAME})
# names of lemon output files will be based on the name of the input file
string(REGEX REPLACE "^(.*)(\\.[^.]*)$" "\\1.c" LEMON_GEN_SOURCE "${INPUT_NAME}")
string(REGEX REPLACE "^(.*)(\\.[^.]*)$" "\\1.h" LEMON_GEN_HEADER "${INPUT_NAME}")
string(REGEX REPLACE "^(.*)(\\.[^.]*)$" "\\1.out" LEMON_GEN_OUT "${INPUT_NAME}")
# copy input to bin directory and run lemon
add_custom_command(
OUTPUT ${LEMON_GEN_OUT} ${LEMON_GEN_SOURCE} ${LEMON_GEN_HEADER}
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_SOURCE_DIR}/${LemonInput} ${LEMON_BIN_INPUT}
COMMAND ${LEMON_EXECUTABLE} ${INPUT_NAME} ${LEMON_${Name}_EXTRA_ARGS}
DEPENDS ${LemonInput} ${LEMON_TEMPLATE} ${LEMON_EXECUTABLE_TARGET}
COMMENT "[LEMON][${Name}] Building parser with ${LEMON_EXECUTABLE}"
)
# rename generated outputs
if(NOT "${LemonSource}" STREQUAL "${LEMON_GEN_SOURCE}")
add_custom_command(
OUTPUT ${LemonSource}
COMMAND ${CMAKE_COMMAND} -E copy ${LEMON_GEN_SOURCE} ${LemonSource}
DEPENDS ${LemonInput} ${LEMON_EXECUTABLE_TARGET} ${LEMON_GEN_SOURCE}
)
set(LEMON_${Name}_OUTPUTS ${LemonSource} ${LEMON_${Name}_OUTPUTS})
endif(NOT "${LemonSource}" STREQUAL "${LEMON_GEN_SOURCE}")
if(NOT "${LemonHeader}" STREQUAL "${LEMON_GEN_HEADER}")
add_custom_command(
OUTPUT ${LemonHeader}
COMMAND ${CMAKE_COMMAND} -E copy ${LEMON_GEN_HEADER} ${LemonHeader}
DEPENDS ${LemonInput} ${LEMON_EXECUTABLE_TARGET} ${LEMON_GEN_HEADER}
)
set(LEMON_${Name}_OUTPUTS ${LemonHeader} ${LEMON_${Name}_OUTPUTS})
endif(NOT "${LemonHeader}" STREQUAL "${LEMON_GEN_HEADER}")
set(LEMON_${Name}_OUTPUTS ${LEMON_GEN_OUT} ${LemonSource} ${LemonHeader})
# make sure we clean up generated output and copied input
if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}")
set_property(DIRECTORY APPEND PROPERTY ADDITIONAL_MAKE_CLEAN_FILES "${LEMON_${Name}_OUTPUTS}")
else("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}")
set_property(DIRECTORY APPEND PROPERTY ADDITIONAL_MAKE_CLEAN_FILES "${LEMON_${Name}_OUTPUTS};${LEMON_BIN_INPUT}")
endif("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}")
# macro ran successfully
set(LEMON_${Name}_DEFINED TRUE)
endif(NOT ${ARGC} EQUAL 4 AND NOT ${ARGC} EQUAL 5)
endmacro(LEMON_TARGET)
#
#============================================================
# LEMON_Utils.cmake ends here
# Local Variables:
# tab-width: 8
# mode: cmake
# indent-tabs-mode: t
# End:
# ex: shiftwidth=2 tabstop=8

134
cmake/PERPLEX_Util.cmake Normal file
View file

@ -0,0 +1,134 @@
# Defines two macros - PERPLEX_TARGET, which takes perplex inputs and
# runs both perplex and re2c to generate C source code/headers, and
# ADD_PERPLEX_LEMON_DEPENDENCY which is used to set up dependencies between
# scanner and parser targets when necessary.
#
# #====================================================================
# Example:
#
# find_package(LEMON)
# find_package(RE2C)
# find_package(PERPLEX)
#
# LEMON_TARGET(MyParser parser.y ${CMAKE_CURRENT_BINARY_DIR}/parser.cpp
# PERPLEX_TARGET(MyScanner scanner.re ${CMAKE_CURRENT_BINARY_DIR}/scanner.cpp ${CMAKE_CURRENT_BINARY_DIR}/scanner_header.hpp)
# ADD_PERPLEX_LEMON_DEPENDENCY(MyScanner MyParser)
#
# include_directories(${CMAKE_CURRENT_BINARY_DIR})
# add_executable(Foo
# Foo.cc
# ${LEMON_MyParser_OUTPUTS}
# ${PERPLEX_MyScanner_OUTPUTS}
# )
# ====================================================================
#
#=============================================================================
#
# Originally based off of FindBISON.cmake from Kitware's CMake distribution
#
# Copyright (c) 2010-2012 United States Government as represented by
# the U.S. Army Research Laboratory.
# Copyright 2009 Kitware, Inc.
# Copyright 2006 Tristan Carel
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# * 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.
#
# * The names of the authors may not be used to endorse or promote
# products derived from this software without specific prior written
# permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#=============================================================================
#============================================================
# PERPLEX_TARGET (public macro)
#============================================================
macro(PERPLEX_TARGET Name Input OutputSrc OutputHeader)
if(${ARGC} GREATER 4)
set(Template ${ARGV4})
else(${ARGC} GREATER 4)
if(PERPLEX_TEMPLATE)
set(Template ${PERPLEX_TEMPLATE})
else(PERPLEX_TEMPLATE)
message(FATAL_ERROR "\nNo Perplex template file specifed - please specify the file using the PERPLEX_TEMPLATE variable:\ncmake .. -DPERPLEX_TEMPLATE=/path/to/template_file.c\n")
endif(PERPLEX_TEMPLATE)
endif(${ARGC} GREATER 4)
get_filename_component(OutputName ${OutputSrc} NAME)
set(re2c_src "${CMAKE_CURRENT_BINARY_DIR}/${OutputName}.re")
add_custom_command(
OUTPUT ${re2c_src} ${OutputHeader}
COMMAND ${PERPLEX_EXECUTABLE} -c -o ${re2c_src} -i ${OutputHeader} -t ${Template} ${Input}
DEPENDS ${Input} ${Template} ${PERPLEX_EXECUTABLE_TARGET} ${RE2C_EXECUTABLE_TARGET}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMENT "[PERPLEX][${Name}] Generating re2c input with ${PERPLEX_EXECUTABLE}"
)
if(NOT DEBUGGING_GENERATED_SOURCES)
add_custom_command(
OUTPUT ${OutputSrc}
COMMAND ${RE2C_EXECUTABLE} --no-debug-info --no-generation-date -c -o ${OutputSrc} ${re2c_src}
DEPENDS ${Input} ${re2c_src} ${OutputHeader} ${PERPLEX_EXECUTABLE_TARGET} ${RE2C_EXECUTABLE_TARGET}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMENT "[RE2C][${Name}] Building scanner with ${RE2C_EXECUTABLE}"
)
else(NOT DEBUGGING_GENERATED_SOURCES)
add_custom_command(
OUTPUT ${OutputSrc}
COMMAND ${RE2C_EXECUTABLE} --no-generation-date -c -o ${OutputSrc} ${re2c_src}
DEPENDS ${Input} ${re2c_src} ${OutputHeader} ${PERPLEX_EXECUTABLE_TARGET} ${RE2C_EXECUTABLE_TARGET}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMENT "[RE2C][${Name}] Building scanner with ${RE2C_EXECUTABLE}"
)
endif(NOT DEBUGGING_GENERATED_SOURCES)
set(PERPLEX_${Name}_DEFINED TRUE)
set(PERPLEX_${Name}_OUTPUTS ${OutputSrc})
set(PERPLEX_${Name}_INPUT ${Input})
endmacro(PERPLEX_TARGET)
#============================================================
# ADD_PERPLEX_LEMON_DEPENDENCY (public macro)
#============================================================
macro(ADD_PERPLEX_LEMON_DEPENDENCY PERPLEXTarget LemonTarget)
if(NOT PERPLEX_${PERPLEXTarget}_OUTPUTS)
message(SEND_ERROR "PERPLEX target `${PERPLEXTarget}' does not exists.")
endif()
if(NOT LEMON_${LemonTarget}_OUTPUT_HEADER)
message(SEND_ERROR "Lemon target `${LemonTarget}' does not exists.")
endif()
set_source_files_properties(${PERPLEX_${PERPLEXTarget}_OUTPUTS}
PROPERTIES OBJECT_DEPENDS ${LEMON_${LemonTarget}_OUTPUT_HEADER})
endmacro(ADD_PERPLEX_LEMON_DEPENDENCY)
#============================================================
# PERPLEX_Utils.cmake ends here
# Local Variables:
# tab-width: 8
# mode: cmake
# indent-tabs-mode: t
# End:
# ex: shiftwidth=2 tabstop=8

View file

@ -58,9 +58,7 @@ ENDMACRO(EXCLUDE_OR_INSTALL target dest arg_3 )
# optional 4th argument of "TESTABLE", passed to EXCLUDE_OR_INSTALL macro
# optional args can also be used by MSVC-specific code, but it looks like these two uses
# will not conflict because the MSVC args must contain "STRICT"
MACRO(SCL_ADDEXEC execname srcs libs)
STRING(REGEX REPLACE " " ";" srcslist "${srcs}")
STRING(REGEX REPLACE " " ";" libslist "${libs}")
MACRO(SCL_ADDEXEC execname srcslist libslist)
add_executable(${execname} ${srcslist})
target_link_libraries(${execname} ${libslist})
DEFINE_DLL_IMPORTS(${execname} "${libslist}") #add import definitions for all libs that the executable is linked to
@ -75,23 +73,21 @@ MACRO(SCL_ADDEXEC execname srcs libs)
IF(LOCAL_COMPILE_FLAGS)
SET_TARGET_PROPERTIES(${execname} PROPERTIES COMPILE_FLAGS ${LOCAL_COMPILE_FLAGS})
ENDIF(LOCAL_COMPILE_FLAGS)
ENDMACRO(SCL_ADDEXEC execname srcs libs)
ENDMACRO(SCL_ADDEXEC execname srcslist libslist)
#SCL_ADDLIB( libname "source files" "linked libs" ["TESTABLE"] ["MSVC flag" ...])
# optional 4th argument of "TESTABLE", passed to EXCLUDE_OR_INSTALL macro
# optional args can also be used by MSVC-specific code, but it looks like these two uses
# will not conflict because the MSVC args must contain "STRICT"
MACRO(SCL_ADDLIB libname srcs libs)
STRING(REGEX REPLACE " " ";" srcslist "${srcs}")
STRING(REGEX REPLACE " " ";" libslist1 "${libs}")
MACRO(SCL_ADDLIB libname srcslist libslist)
STRING(REGEX REPLACE "-framework;" "-framework " libslist "${libslist1}")
IF(SCL_BUILD_SHARED_LIBS)
add_library(${libname} SHARED ${srcslist})
DEFINE_DLL_EXPORTS(${libname})
if(NOT ${libs} MATCHES "NONE")
if(NOT "${libs}" MATCHES "NONE")
target_link_libraries(${libname} ${libslist})
DEFINE_DLL_IMPORTS(${libname} "${libslist}" )
endif(NOT ${libs} MATCHES "NONE")
endif(NOT "${libs}" MATCHES "NONE")
SET_TARGET_PROPERTIES(${libname} PROPERTIES VERSION ${SCL_ABI_VERSION} SOVERSION ${SCL_ABI_SOVERSION} )
EXCLUDE_OR_INSTALL( ${libname} "lib" "${ARGV3}" )
if(APPLE)
@ -99,29 +95,24 @@ MACRO(SCL_ADDLIB libname srcs libs)
endif(APPLE)
ENDIF(SCL_BUILD_SHARED_LIBS)
IF(SCL_BUILD_STATIC_LIBS AND NOT MSVC)
if( SCL_BUILD_SHARED_LIBS )
set( static_name "${libname}-static" )
else( SCL_BUILD_SHARED_LIBS )
set( static_name ${libname} )
endif( SCL_BUILD_SHARED_LIBS )
add_library(${static_name} STATIC ${srcslist})
DEFINE_DLL_EXPORTS(${static_name})
add_library(${libname}-static STATIC ${srcslist})
DEFINE_DLL_EXPORTS(${libname}-static)
if(NOT ${libs} MATCHES "NONE")
target_link_libraries(${static_name} ${libslist})
DEFINE_DLL_IMPORTS(${static_name} ${libslist} )
target_link_libraries(${libname}-static "${libslist}")
DEFINE_DLL_IMPORTS(${libname}-static ${libslist} )
endif(NOT ${libs} MATCHES "NONE")
IF(NOT WIN32)
SET_TARGET_PROPERTIES(${static_name} PROPERTIES OUTPUT_NAME "${libname}")
SET_TARGET_PROPERTIES(${libname}-static PROPERTIES OUTPUT_NAME "${libname}")
ENDIF(NOT WIN32)
IF(WIN32)
# We need the lib prefix on win32, so add it even if our add_library
# wrapper function has removed it due to the target name - see
# http://www.cmake.org/Wiki/CMake_FAQ#How_do_I_make_my_shared_and_static_libraries_have_the_same_root_name.2C_but_different_suffixes.3F
SET_TARGET_PROPERTIES(${static_name} PROPERTIES PREFIX "lib")
SET_TARGET_PROPERTIES(${libname}-static PROPERTIES PREFIX "lib")
ENDIF(WIN32)
EXCLUDE_OR_INSTALL( ${static_name} "lib" "${ARGV3}" )
EXCLUDE_OR_INSTALL( ${libname}-static "lib" "${ARGV3}" )
if(APPLE)
set_target_properties(${static_name} PROPERTIES LINK_FLAGS "-flat_namespace -undefined suppress")
set_target_properties(${libname}-static PROPERTIES LINK_FLAGS "-flat_namespace -undefined suppress")
endif(APPLE)
ENDIF(SCL_BUILD_STATIC_LIBS AND NOT MSVC)
# Enable extra compiler flags if local libraries and/or global options dictate
@ -136,7 +127,7 @@ MACRO(SCL_ADDLIB libname srcs libs)
SET_TARGET_PROPERTIES(${libname} PROPERTIES COMPILE_FLAGS ${LOCAL_COMPILE_FLAGS})
ENDIF(BUILD_SHARED_LIBS)
IF(BUILD_STATIC_LIBS AND NOT MSVC)
SET_TARGET_PROPERTIES(${static_name} PROPERTIES COMPILE_FLAGS ${LOCAL_COMPILE_FLAGS})
SET_TARGET_PROPERTIES(${libname}-static PROPERTIES COMPILE_FLAGS ${LOCAL_COMPILE_FLAGS})
ENDIF(BUILD_STATIC_LIBS AND NOT MSVC)
ENDIF(LOCAL_COMPILE_FLAGS)
ENDMACRO(SCL_ADDLIB libname srcs libs)
ENDMACRO(SCL_ADDLIB libname srcslist libslist)

View file

@ -0,0 +1,100 @@
# Inherit the parent CMake setting
set(CURRENT_SOURCE_DIR "@CMAKE_CURRENT_SOURCE_DIR@")
set(LEMON_EXECUTABLE "@LEMON_EXECUTABLE@")
set(RE2C_EXECUTABLE "@RE2C_EXECUTABLE@")
set(PERPLEX_EXECUTABLE "@PERPLEX_EXECUTABLE@")
set(SYNC_SCRIPT "@SYNC_SCRIPT@")
set(SYNC_TARGET_NAME "@SYNC_TARGET_NAME@")
set(DEBUGGING_GENERATED_SOURCES "@DEBUGGING_GENERATED_SOURCES@")
if(NOT DEBUGGING_GENERATED_SOURCES)
# Include the file the provides the baseline against which
# current files will be compared
include("@BASELINE_INFORMATION_FILE@")
# Define a variety of convenience routines
include("@PROJECT_CMAKE_DIR@/Generated_Source_Utils.cmake")
# The following need to be checked:
#
# 1. baseline input MD5 hashes against the current input
# hashes. If the cached sources were generated using
# inputs other than the current inputs, note they are
# out of sync but don't stop. Templates used by perplex
# and lemon are part of this group.
#
# 2. baseline cached source MD5 hashes against current
# cached source MD5 hashes. Making sure no changes
# have been made to the generated sources. If the
# cached sources need to be updated (see #1, for example)
# their MD5 hashes need to be updated at the same time.
#
# 3. MD5 hashes of output generated by the tools against
# the MD5 hashes of the equalivent cached sources, if
# a) the tool versions are the same b) the input MD5
# hash comparisions were the same and c) the baseline
# test from #2 passed. This is done to detect platform
# differences in output sources, but is only valid if
# the input files are in their "pristine" state and the
# toolchain is equalivent to that used for the baseline.
# Individually verify all of the files in question.
set(input_files "@INPUT_FILELIST@")
VERIFY_FILES("${input_files}" 0 input_unchanged)
set(template_files "@TEMPLATE_FILELIST@")
VERIFY_FILES("${template_files}" 1 templates_unchanged)
set(cached_files "@CACHED_FILELIST@")
VERIFY_FILES("${cached_files}" 1 cached_unchanged)
if(NOT cached_unchanged)
message(FATAL_ERROR "Cached generated sources do not match the MD5 hashes present in @BASELINE_INFORMATION_FILE@ - if updating cached sources, remember that the build enforces the requirement that associated MD5 hashes in @BASELINE_INFORMATION_FILE@ are current as well. Cached generated sources should not be directly edited.")
endif(NOT cached_unchanged)
GET_GENERATOR_EXEC_VERSIONS()
if("${lemon_version}" VERSION_EQUAL "${baseline_lemon_version}" AND "${perplex_version}" VERSION_EQUAL "${baseline_perplex_version}" AND "${re2c_version}" VERSION_EQUAL "${baseline_re2c_version}")
set(tool_versions_equal 1)
else()
set(tool_versions_equal 0)
endif()
if(NOT input_unchanged)
if(templates_unchanged AND tool_versions_equal)
message("Input files changed - syncing cached outputs")
execute_process(COMMAND ${CMAKE_COMMAND} -P ${SYNC_SCRIPT} OUTPUT_VARIABLE output)
else(templates_unchanged AND tool_versions_equal)
if(NOT templates_unchanged AND NOT tool_versions_equal)
message("Input files have been updated, but templates and current tool versions do not match those previously used to generate cached sources. Automatic syncing will not proceed.")
message("To force syncing, use the build target ${SYNC_TARGET_NAME}")
else(NOT templates_unchanged AND NOT tool_versions_equal)
if(NOT templates_unchanged)
message("Input files have been updated, but templates do not match those previously used to generate cached sources. Automatic syncing will not proceed.")
message("To force syncing, use the build target ${SYNC_TARGET_NAME}")
endif(NOT templates_unchanged)
if(NOT tool_versions_equal)
message("Input files have been updated, but tool versions do not match those previously used to generate cached sources. Automatic syncing will not proceed.")
message("To force syncing, use the build target ${SYNC_TARGET_NAME}")
endif(NOT tool_versions_equal)
endif(NOT templates_unchanged AND NOT tool_versions_equal)
endif(templates_unchanged AND tool_versions_equal)
else(NOT input_unchanged)
if(templates_unchanged AND cached_unchanged AND tool_versions_equal)
# Under these conditions, the uncached generated output should be equal to the cached files.
# Check if it is - a difference here may indicate a platform-specific behavior in one of the
# generators.
set(build_files "@BUILD_OUTPUT_FILELIST@")
VERIFY_FILES("${build_files}" 1 platform_unchanged)
if(NOT platform_unchanged)
message("Note: give these build inputs and tools, source files should be identical to generated files. Differences were still observed - possible indiciation of platform-specific generator behavior.")
endif(NOT platform_unchanged)
endif(templates_unchanged AND cached_unchanged AND tool_versions_equal)
endif(NOT input_unchanged)
else(NOT DEBUGGING_GENERATED_SOURCES)
message("\nNote: DEBUGGING_GENERATED_SOURCES is enabled - generated outputs will contain configuration-specific debugging information, so syncing cached output files is not possible. To restore normal behavior, disable DEBUGGING_GENERATED_SOURCES.\n")
endif(NOT DEBUGGING_GENERATED_SOURCES)
# Local Variables:
# tab-width: 8
# mode: cmake
# indent-tabs-mode: t
# End:
# ex: shiftwidth=2 tabstop=8

View file

@ -0,0 +1,83 @@
# Inherit the parent CMake setting
set(CURRENT_SOURCE_DIR @CMAKE_CURRENT_SOURCE_DIR@)
set(CURRENT_BINARY_DIR @CMAKE_CURRENT_BINARY_DIR@)
set(CACHED_FILES_DIR @CACHED_FILES_DIR@)
set(LEMON_EXECUTABLE @LEMON_EXECUTABLE@)
set(RE2C_EXECUTABLE @RE2C_EXECUTABLE@)
set(PERPLEX_EXECUTABLE @PERPLEX_EXECUTABLE@)
set(LOCKED_SOURCE_DIR @LOCKED_SOURCE_DIR@)
set(DEBUGGING_GENERATED_SOURCES @DEBUGGING_GENERATED_SOURCES@)
if(NOT DEBUGGING_GENERATED_SOURCES)
# Define a variety of convenience routines
include(@PROJECT_CMAKE_DIR@/Generated_Source_Utils.cmake)
# The following steps are executed to sync generated sources:
#
# 1. Create a new verification_info.cmake file and populate
# it with the current versions of perplex, re2c and lemon.
# Also add the MD5 sums for current template files.
#
# 2. For all files that need to be updated in the cache,
# calculate new MD5 sums and add them to the new
# verification_info.cmake - this is usually the input
# files and the generated outputs.
#
# 3. Overwrite the original cached verification_info.cmake
# and generated files with the new ones. If LOCKED_SOURCE_DIR
# is ON, this step will not be carried out - instead, an
# informational message with manual updating instructions
# will be printed.
set(new_info_file "${CURRENT_BINARY_DIR}/verification_info.cmake.new")
file(WRITE ${new_info_file} "# Autogenerated verification information\n")
# Handle generator version numbers
GET_GENERATOR_EXEC_VERSIONS()
file(APPEND ${new_info_file} "set(baseline_lemon_version \"${lemon_version}\")\n")
file(APPEND ${new_info_file} "set(baseline_re2c_version \"${re2c_version}\")\n")
file(APPEND ${new_info_file} "set(baseline_perplex_version \"${perplex_version}\")\n")
# Handle template files
set(template_files "@TEMPLATE_FILELIST@")
WRITE_MD5_SUMS("${template_files}" "${new_info_file}")
# Handle input files
set(input_files "@INPUT_FILELIST@")
WRITE_MD5_SUMS("${input_files}" "${new_info_file}")
# Handle generated files
set(output_files "@BUILD_OUTPUT_FILELIST@")
WRITE_MD5_SUMS("${output_files}" "${new_info_file}")
# Copy files into their final locations
if(NOT LOCKED_SOURCE_DIR)
configure_file(${new_info_file} "${CACHED_FILES_DIR}/verification_info.cmake" COPYONLY)
foreach(outf ${output_files})
get_filename_component(filecorename ${outf} NAME)
message("copying ${outf} to ${CACHED_FILES_DIR}/${filecorename}")
configure_file(${outf} "${CACHED_FILES_DIR}/${filecorename}" COPYONLY)
endforeach(outf ${output_files})
else(NOT LOCKED_SOURCE_DIR)
message("Source directory writing is locked - LOCKED_SOURCE_DIR is set.")
message("To update the generated files, manually copy the following to ${CACHED_FILES_DIR}:")
message(" ${new_info_file} (rename to verification_info.cmake)")
foreach(outf ${output_files})
message(" ${outf}")
endforeach(outf ${output_files})
endif(NOT LOCKED_SOURCE_DIR)
else (NOT DEBUGGING_GENERATED_SOURCES)
message("\nNote: DEBUGGING_GENERATED_SOURCES is enabled - generated outputs will contain configuration-specific debugging information, so syncing cached output files is not possible. To restore normal behavior, disable DEBUGGING_GENERATED_SOURCES.\n")
endif(NOT DEBUGGING_GENERATED_SOURCES)
# Local Variables:
# tab-width: 8
# mode: cmake
# indent-tabs-mode: t
# End:
# ex: shiftwidth=2 tabstop=8

View file

@ -0,0 +1,37 @@
# Inherit the parent CMake setting
set(DEBUGGING_GENERATED_SOURCES @DEBUGGING_GENERATED_SOURCES@)
set(CURRENT_SOURCE_DIR @CMAKE_CURRENT_SOURCE_DIR@)
# Include the file the provides the baseline against which
# current files will be compared
if(NOT DEBUGGING_GENERATED_SOURCES)
include(@BASELINE_INFORMATION_FILE@)
# Define a variety of convenience routines
include(@PROJECT_CMAKE_DIR@/Generated_Source_Utils.cmake)
# Individually verify all of the files in question.
set(filelist "@CACHED_FILELIST@")
VERIFY_FILES("${filelist}" 1 srcs_pass)
if(NOT srcs_pass)
message(FATAL_ERROR "Generated sources have been modified. These files should never be modified directly except when debugging faulty output from the generators - changes to lexer and parser logic should be made to the generator input files. If this is a debugging situation, set the variable DEBUGGING_GENERATED_SOURCES to ON during the CMake configure.")
endif(NOT srcs_pass)
# If we got by that test, see if it looks like these
# sources came from the current input files. It's not
# a failure condition if they didn't, but warn about it.
set(filelist "@INPUT_FILELIST@")
VERIFY_FILES("${filelist}" 0 inputs_same)
if(NOT inputs_same)
message("Note: cached generated sources are not in sync with input files.")
endif(NOT inputs_same)
endif(NOT DEBUGGING_GENERATED_SOURCES)
# Local Variables:
# tab-width: 8
# mode: cmake
# indent-tabs-mode: t
# End:
# ex: shiftwidth=2 tabstop=8

View file

@ -16375,4 +16375,4 @@ FUNCTION vector_difference
END_FUNCTION;
END_SCHEMA;

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -10,5 +10,5 @@ if(NOT DEFINED MAN_DIR)
endif(NOT DEFINED MAN_DIR)
IF(NOT WIN32)
INSTALL(FILES ${scl_MANS} DESTINATION ${CMAKE_INSTALL_PREFIX}/${MAN_DIR}/man1)
INSTALL(FILES ${scl_MANS} DESTINATION ${MAN_DIR}/man1)
ENDIF(NOT WIN32)

View file

@ -2,11 +2,8 @@ SET(express_HDRS
express/alg.h
express/basic.h
express/caseitem.h
express/de_end.h
express/decstart.h
express/defstart.h
express/dict.h
express/entity.h
express/dict.h
express/entity.h
express/error.h
express/expbasic.h
express/expr.h
@ -30,7 +27,3 @@ SET(exppp_HDRS
exppp/exppp.h
)
install(FILES ${exppp_HDRS} DESTINATION include/exppp)
SET(SCL_noinst_HEADERS
sclprefixes.h
)

View file

@ -1,3 +1,5 @@
#ifndef EXPPP_H
#define EXPPP_H
#include <scl_export.h>
extern SCL_EXPPP_EXPORT int exppp_nesting_indent; /* default nesting indent */
@ -14,6 +16,7 @@ extern SCL_EXPPP_EXPORT bool exppp_reference_info; /* if true, add commentary
extern SCL_EXPPP_EXPORT bool exppp_preserve_comments; /* if true, preserve comments where */
/* possible */
extern SCL_EXPPP_EXPORT char * exppp_output_filename; /* force output filename */
extern SCL_EXPPP_EXPORT bool exppp_output_filename_reset; /* if true, force output filename */
SCL_EXPPP_EXPORT void EXPRESSout( Express e );
@ -60,3 +63,4 @@ SCL_EXPPP_EXPORT int WHEREto_buffer( Linked_List w, char * buffer, int length );
SCL_EXPPP_EXPORT int EXPRlength( Expression e );
SCL_EXPPP_EXPORT int count_newlines( char *s );
#endif

View file

@ -37,10 +37,6 @@
*
*/
/*************/
/* constants */
/*************/
/*****************/
/* packages used */
/*****************/
@ -59,10 +55,6 @@ typedef struct Scope_ * Function;
typedef struct Scope_ * Rule;
typedef struct Where_ * Where;
/****************/
/* modules used */
/****************/
/***************************/
/* hidden type definitions */
/***************************/
@ -117,19 +109,11 @@ struct Where_ {
/* global variables */
/********************/
#ifdef ALGORITHM_C
#include "defstart.h"
#else
#include "decstart.h"
#endif /* ALGORITHM_C */
GLOBAL SCL_EXPRESS_EXPORT struct freelist_head ALG_fl;
GLOBAL SCL_EXPRESS_EXPORT struct freelist_head FUNC_fl;
GLOBAL SCL_EXPRESS_EXPORT struct freelist_head RULE_fl;
GLOBAL SCL_EXPRESS_EXPORT struct freelist_head PROC_fl;
GLOBAL SCL_EXPRESS_EXPORT struct freelist_head WHERE_fl;
#include "de_end.h"
extern SCL_EXPRESS_EXPORT struct freelist_head ALG_fl;
extern SCL_EXPRESS_EXPORT struct freelist_head FUNC_fl;
extern SCL_EXPRESS_EXPORT struct freelist_head RULE_fl;
extern SCL_EXPRESS_EXPORT struct freelist_head PROC_fl;
extern SCL_EXPRESS_EXPORT struct freelist_head WHERE_fl;
/******************************/
/* macro function definitions */
@ -181,5 +165,4 @@ extern SCL_EXPRESS_EXPORT Scope ALGcreate PROTO( ( char ) );
extern SCL_EXPRESS_EXPORT void ALGinitialize PROTO( ( void ) );
extern SCL_EXPRESS_EXPORT void ALGput_full_text PROTO( ( Scope, int, int ) );
#endif /* ALGORITHM_H */

View file

@ -70,15 +70,7 @@ struct Case_Item_ {
/* global variables */
/********************/
#ifdef CASE_ITEM_C
#include "defstart.h"
#else
#include "decstart.h"
#endif /*CASE_ITEM_C*/
GLOBAL SCL_EXPRESS_EXPORT struct freelist_head CASE_IT_fl;
#include "de_end.h"
extern SCL_EXPRESS_EXPORT struct freelist_head CASE_IT_fl;
/******************************/
/* macro function definitions */

View file

@ -72,15 +72,7 @@ typedef HashEntry DictionaryEntry;
/* global variables */
/********************/
#ifdef DICTIONARY_C
#include "defstart.h"
#else
#include "decstart.h"
#endif /*DICTIONARY_C*/
GLOBAL SCL_EXPRESS_EXPORT char DICT_type; /**< set as a side-effect of DICT lookup routines to type of object found */
#include "de_end.h"
extern SCL_EXPRESS_EXPORT char DICT_type; /**< set as a side-effect of DICT lookup routines to type of object found */
/*******************************/
/* macro function definitions */

View file

@ -102,17 +102,8 @@ struct Entity_ {
/* global variables */
/********************/
#ifdef ENTITY_C
#include "defstart.h"
#else
#include "decstart.h"
#endif /* ENTITY_C */
GLOBAL SCL_EXPRESS_EXPORT struct freelist_head ENTITY_fl;
GLOBAL SCL_EXPRESS_EXPORT int ENTITY_MARK INITIALLY( 0 );
#include "de_end.h"
extern SCL_EXPRESS_EXPORT struct freelist_head ENTITY_fl;
extern SCL_EXPRESS_EXPORT int ENTITY_MARK;
/******************************/
/* macro function definitions */
@ -162,6 +153,6 @@ extern SCL_EXPRESS_EXPORT Linked_List ENTITYget_all_attributes PROTO( ( Entity
extern SCL_EXPRESS_EXPORT bool ENTITYhas_supertype PROTO( ( Entity, Entity ) );
extern SCL_EXPRESS_EXPORT void ENTITYadd_instance PROTO( ( Entity, Generic ) );
extern SCL_EXPRESS_EXPORT int ENTITYget_initial_offset PROTO( ( Entity ) );
extern SCL_EXPRESS_EXPORT bool ENTITYdeclares_variable PROTO( ( Entity, struct Variable_ * ) );
extern SCL_EXPRESS_EXPORT int ENTITYdeclares_variable PROTO( ( Entity, struct Variable_ * ) );
#endif /* ENTITY_H */

View file

@ -81,37 +81,29 @@ typedef struct Error_Warning_ {
/* global variables */
/********************/
#ifdef ERROR_C
#include "defstart.h"
#else
#include "decstart.h"
#endif /* ERROR_C */
GLOBAL SCL_EXPRESS_EXPORT bool __ERROR_buffer_errors INITIALLY( false );
GLOBAL SCL_EXPRESS_EXPORT char * current_filename INITIALLY( "stdin" );
extern SCL_EXPRESS_EXPORT bool __ERROR_buffer_errors;
extern SCL_EXPRESS_EXPORT char * current_filename;
/* flag to remember whether non-warning errors have occurred */
GLOBAL SCL_EXPRESS_EXPORT bool ERRORoccurred INITIALLY( false );
extern SCL_EXPRESS_EXPORT bool ERRORoccurred;
GLOBAL SCL_EXPRESS_EXPORT Error experrc INITIALLY( ERROR_none );
GLOBAL SCL_EXPRESS_EXPORT Error ERROR_subordinate_failed INITIALLY( ERROR_none );
GLOBAL SCL_EXPRESS_EXPORT Error ERROR_syntax_expecting INITIALLY( ERROR_none );
extern SCL_EXPRESS_EXPORT Error experrc;
extern SCL_EXPRESS_EXPORT Error ERROR_subordinate_failed;
extern SCL_EXPRESS_EXPORT Error ERROR_syntax_expecting;
/* all of these are 1 if true, 0 if false switches */
/* for debugging fedex */
GLOBAL SCL_EXPRESS_EXPORT int ERRORdebugging INITIALLY( 0 );
extern SCL_EXPRESS_EXPORT int ERRORdebugging;
/* for debugging malloc during resolution */
GLOBAL SCL_EXPRESS_EXPORT int malloc_debug_resolve INITIALLY( 0 );
extern SCL_EXPRESS_EXPORT int malloc_debug_resolve;
/* for debugging yacc/lex */
GLOBAL SCL_EXPRESS_EXPORT int debug INITIALLY( 0 );
extern SCL_EXPRESS_EXPORT int debug;
GLOBAL SCL_EXPRESS_EXPORT struct Linked_List_ * ERRORwarnings;
GLOBAL SCL_EXPRESS_EXPORT struct freelist_head ERROR_OPT_fl;
extern SCL_EXPRESS_EXPORT struct Linked_List_ * ERRORwarnings;
extern SCL_EXPRESS_EXPORT struct freelist_head ERROR_OPT_fl;
GLOBAL SCL_EXPRESS_EXPORT void ( *ERRORusage_function ) PROTO( ( void ) );
#include "de_end.h"
extern SCL_EXPRESS_EXPORT void ( *ERRORusage_function )( void );
/******************************/
/* macro function definitions */
@ -133,8 +125,6 @@ extern SCL_EXPRESS_EXPORT void ERROR_flush_message_buffer PROTO( ( void ) );
/* Inline functions */
/********************/
#if supports_inline_functions || defined(ERROR_C)
static_inline void ERRORdisable( Error error ) {
if( error != ERROR_none ) {
error->enabled = false;
@ -176,8 +166,6 @@ static_inline void ERRORflush_messages( void ) {
}
}
#endif /*supports_inline_functions || defined(ERROR_C)*/
/***********************/
/* function prototypes */
/***********************/
@ -194,10 +182,6 @@ extern SCL_EXPRESS_EXPORT void ERRORdestroy PROTO( ( Error ) );
struct Symbol_; /* mention Symbol to avoid warning on following line */
extern SCL_EXPRESS_EXPORT void ERRORreport_with_symbol PROTO( ( Error, struct Symbol_ *, ... ) );
extern SCL_EXPRESS_EXPORT void ERRORreport_with_line PROTO( ( Error, int, ... ) );
#if !supports_inline_functions
extern SCL_EXPRESS_EXPORT void ERRORbuffer_messages PROTO( ( bool ) );
extern SCL_EXPRESS_EXPORT void ERRORflush_messages PROTO( ( void ) );
#endif
#if !defined(__MSVC__) && !defined(__BORLAND__)
extern SCL_EXPRESS_EXPORT void ERROR_start_message_buffer PROTO( ( void ) );

View file

@ -1,4 +1,3 @@
/*
* This software was developed by U.S. Government employees as part of
* their official duties and is not subject to copyright.

View file

@ -64,6 +64,10 @@
#include <math.h>
#include "expbasic.h" /* get basic definitions */
#ifndef MAXINT
#define MAXINT (~(1 << 31))
#endif
/************/
/* typedefs */
/************/
@ -181,31 +185,23 @@ struct EXPop_entry {
/* global variables */
/********************/
#ifdef EXPRESSION_C
#include "defstart.h"
#else
#include "decstart.h"
#endif /*EXPRESSION_C*/
extern SCL_EXPRESS_EXPORT struct EXPop_entry EXPop_table[OP_LAST];
GLOBAL SCL_EXPRESS_EXPORT struct EXPop_entry EXPop_table[OP_LAST];
extern SCL_EXPRESS_EXPORT Expression LITERAL_E;
extern SCL_EXPRESS_EXPORT Expression LITERAL_INFINITY;
extern SCL_EXPRESS_EXPORT Expression LITERAL_PI;
extern SCL_EXPRESS_EXPORT Expression LITERAL_ZERO;
extern SCL_EXPRESS_EXPORT Expression LITERAL_ONE;
GLOBAL SCL_EXPRESS_EXPORT Expression LITERAL_E INITIALLY( EXPRESSION_NULL );
GLOBAL SCL_EXPRESS_EXPORT Expression LITERAL_INFINITY INITIALLY( EXPRESSION_NULL );
GLOBAL SCL_EXPRESS_EXPORT Expression LITERAL_PI INITIALLY( EXPRESSION_NULL );
GLOBAL SCL_EXPRESS_EXPORT Expression LITERAL_ZERO INITIALLY( EXPRESSION_NULL );
GLOBAL SCL_EXPRESS_EXPORT Expression LITERAL_ONE;
extern SCL_EXPRESS_EXPORT Error ERROR_bad_qualification;
extern SCL_EXPRESS_EXPORT Error ERROR_integer_expression_expected;
extern SCL_EXPRESS_EXPORT Error ERROR_implicit_downcast;
extern SCL_EXPRESS_EXPORT Error ERROR_ambig_implicit_downcast;
GLOBAL SCL_EXPRESS_EXPORT Error ERROR_bad_qualification INITIALLY( ERROR_none );
GLOBAL SCL_EXPRESS_EXPORT Error ERROR_integer_expression_expected INITIALLY( ERROR_none );
GLOBAL SCL_EXPRESS_EXPORT Error ERROR_implicit_downcast INITIALLY( ERROR_none );
GLOBAL SCL_EXPRESS_EXPORT Error ERROR_ambig_implicit_downcast INITIALLY( ERROR_none );
GLOBAL SCL_EXPRESS_EXPORT struct freelist_head EXP_fl;
GLOBAL SCL_EXPRESS_EXPORT struct freelist_head OP_fl;
GLOBAL SCL_EXPRESS_EXPORT struct freelist_head QUERY_fl;
GLOBAL SCL_EXPRESS_EXPORT struct freelist_head QUAL_ATTR_fl;
#include "de_end.h"
extern SCL_EXPRESS_EXPORT struct freelist_head EXP_fl;
extern SCL_EXPRESS_EXPORT struct freelist_head OP_fl;
extern SCL_EXPRESS_EXPORT struct freelist_head QUERY_fl;
extern SCL_EXPRESS_EXPORT struct freelist_head QUAL_ATTR_fl;
/******************************/
/* macro function definitions */
@ -270,24 +266,4 @@ extern SCL_EXPRESS_EXPORT void EXPcleanup PROTO( ( void ) );
extern SCL_EXPRESS_EXPORT Type EXPtype PROTO( ( Expression, struct Scope_ * ) );
extern SCL_EXPRESS_EXPORT int EXPget_integer_value PROTO( ( Expression ) );
/********************/
/* inline functions */
/********************/
#if supports_inline_functions || defined(EXPRESSION_C)
static_inline
int
OPget_number_of_operands( Op_Code op ) {
if( ( op == OP_NEGATE ) || ( op == OP_NOT ) ) {
return 1;
} else if( op == OP_SUBCOMPONENT ) {
return 3;
} else {
return 2;
}
}
#endif /* supports_inline_functions || defined(EXPRESSION_C) */
#endif /*EXPRESSION_H*/

View file

@ -88,169 +88,151 @@ struct Express_ {
/* global variables */
/********************/
#ifdef EXPRESS_C
# define GLOBAL
# define INITIALLY(value) = value
#else
# define GLOBAL extern
# define INITIALLY(value)
#endif /*EXPRESS_C*/
extern SCL_EXPRESS_EXPORT Linked_List EXPRESS_path;
extern SCL_EXPRESS_EXPORT int EXPRESSpass;
#ifdef YYDEBUG
extern SCL_EXPRESS_EXPORT int yydebug;
extern SCL_EXPRESS_EXPORT int yydbg_upper_limit;
extern SCL_EXPRESS_EXPORT int yydbg_lower_limit;
extern SCL_EXPRESS_EXPORT int yydbg_verbose;
#endif
extern SCL_EXPRESS_EXPORT void ( *EXPRESSinit_args ) PROTO( ( int, char ** ) );
extern SCL_EXPRESS_EXPORT void ( *EXPRESSinit_parse ) PROTO( ( void ) );
extern SCL_EXPRESS_EXPORT int ( *EXPRESSfail ) PROTO( ( Express ) );
extern SCL_EXPRESS_EXPORT int ( *EXPRESSsucceed ) PROTO( ( Express ) );
extern SCL_EXPRESS_EXPORT void ( *EXPRESSbackend ) PROTO( ( Express ) );
extern SCL_EXPRESS_EXPORT char * EXPRESSprogram_name;
extern char EXPRESSgetopt_options[]; /* initialized elsewhere */
extern SCL_EXPRESS_EXPORT int ( *EXPRESSgetopt ) PROTO( ( int, char * ) );
extern SCL_EXPRESS_EXPORT bool EXPRESSignore_duplicate_schemas;
GLOBAL SCL_EXPRESS_EXPORT Linked_List EXPRESS_path;
GLOBAL SCL_EXPRESS_EXPORT int EXPRESSpass;
extern SCL_EXPRESS_EXPORT Dictionary EXPRESSbuiltins; /* procedures/functions */
GLOBAL SCL_EXPRESS_EXPORT void ( *EXPRESSinit_args ) PROTO( ( int, char ** ) ) INITIALLY( 0 );
GLOBAL SCL_EXPRESS_EXPORT void ( *EXPRESSinit_parse ) PROTO( ( void ) ) INITIALLY( 0 );
GLOBAL SCL_EXPRESS_EXPORT int ( *EXPRESSfail ) PROTO( ( Express ) ) INITIALLY( 0 );
GLOBAL SCL_EXPRESS_EXPORT int ( *EXPRESSsucceed ) PROTO( ( Express ) ) INITIALLY( 0 );
GLOBAL SCL_EXPRESS_EXPORT void ( *EXPRESSbackend ) PROTO( ( Express ) ) INITIALLY( 0 );
GLOBAL SCL_EXPRESS_EXPORT char * EXPRESSprogram_name;
extern char EXPRESSgetopt_options[256]; /**< initialized elsewhere */
GLOBAL SCL_EXPRESS_EXPORT int ( *EXPRESSgetopt ) PROTO( ( int, char * ) ) INITIALLY( 0 );
GLOBAL SCL_EXPRESS_EXPORT bool EXPRESSignore_duplicate_schemas INITIALLY( false );
extern SCL_EXPRESS_EXPORT Error ERROR_bail_out;
extern SCL_EXPRESS_EXPORT Error ERROR_syntax;
extern SCL_EXPRESS_EXPORT Error ERROR_unlabelled_param_type;
extern SCL_EXPRESS_EXPORT Error ERROR_file_unreadable;
extern SCL_EXPRESS_EXPORT Error ERROR_file_unwriteable;
extern SCL_EXPRESS_EXPORT Error ERROR_warn_unsupported_lang_feat;
GLOBAL SCL_EXPRESS_EXPORT Dictionary EXPRESSbuiltins; /**< procedures/functions */
extern SCL_EXPRESS_EXPORT struct Scope_ * FUNC_NVL;
extern SCL_EXPRESS_EXPORT struct Scope_ * FUNC_USEDIN;
GLOBAL SCL_EXPRESS_EXPORT Error ERROR_bail_out INITIALLY( ERROR_none );
GLOBAL SCL_EXPRESS_EXPORT Error ERROR_syntax INITIALLY( ERROR_none );
GLOBAL SCL_EXPRESS_EXPORT Error ERROR_unlabelled_param_type INITIALLY( ERROR_none );
GLOBAL SCL_EXPRESS_EXPORT Error ERROR_file_unreadable;
GLOBAL SCL_EXPRESS_EXPORT Error ERROR_file_unwriteable;
GLOBAL SCL_EXPRESS_EXPORT Error ERROR_warn_unsupported_lang_feat;
GLOBAL SCL_EXPRESS_EXPORT struct Scope_ * FUNC_NVL;
GLOBAL SCL_EXPRESS_EXPORT struct Scope_ * FUNC_USEDIN;
GLOBAL SCL_EXPRESS_EXPORT char * KW_ABS INITIALLY( "ABS" );
GLOBAL SCL_EXPRESS_EXPORT char * KW_ABSTRACT INITIALLY( "ABSTRACT" );
GLOBAL SCL_EXPRESS_EXPORT char * KW_ACOS INITIALLY( "ACOS" );
GLOBAL SCL_EXPRESS_EXPORT char * KW_AGGREGATE INITIALLY( "AGGREGATE" );
GLOBAL SCL_EXPRESS_EXPORT char * KW_ALIAS INITIALLY( "ALIAS" );
GLOBAL SCL_EXPRESS_EXPORT char * KW_AND INITIALLY( "AND" );
GLOBAL SCL_EXPRESS_EXPORT char * KW_ANDOR INITIALLY( "ANDOR" );
GLOBAL SCL_EXPRESS_EXPORT char * KW_ARRAY INITIALLY( "ARRAY" );
GLOBAL SCL_EXPRESS_EXPORT char * KW_AS INITIALLY( "AS" );
GLOBAL SCL_EXPRESS_EXPORT char * KW_ASIN INITIALLY( "ASIN" );
GLOBAL SCL_EXPRESS_EXPORT char * KW_ATAN INITIALLY( "ATAN" );
GLOBAL SCL_EXPRESS_EXPORT char * KW_BAG INITIALLY( "BAG" );
GLOBAL SCL_EXPRESS_EXPORT char * KW_BEGIN INITIALLY( "BEGIN" );
GLOBAL SCL_EXPRESS_EXPORT char * KW_BINARY INITIALLY( "BINARY" );
GLOBAL SCL_EXPRESS_EXPORT char * KW_BLENGTH INITIALLY( "BLENGTH" );
GLOBAL SCL_EXPRESS_EXPORT char * KW_BOOLEAN INITIALLY( "BOOLEAN" );
GLOBAL SCL_EXPRESS_EXPORT char * KW_BY INITIALLY( "BY" );
GLOBAL SCL_EXPRESS_EXPORT char * KW_CASE INITIALLY( "CASE" );
GLOBAL SCL_EXPRESS_EXPORT char * KW_CONST_E INITIALLY( "CONST_E" );
GLOBAL SCL_EXPRESS_EXPORT char * KW_CONSTANT INITIALLY( "CONSTANT" );
GLOBAL SCL_EXPRESS_EXPORT char * KW_CONTEXT INITIALLY( "CONTEXT" );
GLOBAL SCL_EXPRESS_EXPORT char * KW_COS INITIALLY( "COS" );
GLOBAL SCL_EXPRESS_EXPORT char * KW_DERIVE INITIALLY( "DERIVE" );
GLOBAL SCL_EXPRESS_EXPORT char * KW_DIV INITIALLY( "DIV" );
GLOBAL SCL_EXPRESS_EXPORT char * KW_ELSE INITIALLY( "ELSE" );
GLOBAL SCL_EXPRESS_EXPORT char * KW_END INITIALLY( "END" );
GLOBAL SCL_EXPRESS_EXPORT char * KW_END_ALIAS INITIALLY( "END_ALIAS" );
GLOBAL SCL_EXPRESS_EXPORT char * KW_END_CASE INITIALLY( "END_CASE" );
GLOBAL SCL_EXPRESS_EXPORT char * KW_END_CONSTANT INITIALLY( "END_CONSTANT" );
GLOBAL SCL_EXPRESS_EXPORT char * KW_END_CONTEXT INITIALLY( "END_CONTEXT" );
GLOBAL SCL_EXPRESS_EXPORT char * KW_END_ENTITY INITIALLY( "END_ENTITY" );
GLOBAL SCL_EXPRESS_EXPORT char * KW_END_FUNCTION INITIALLY( "END_FUNCTION" );
GLOBAL SCL_EXPRESS_EXPORT char * KW_END_IF INITIALLY( "END_IF" );
GLOBAL SCL_EXPRESS_EXPORT char * KW_END_LOCAL INITIALLY( "END_LOCAL" );
GLOBAL SCL_EXPRESS_EXPORT char * KW_END_MODEL INITIALLY( "END_MODEL" );
GLOBAL SCL_EXPRESS_EXPORT char * KW_END_PROCEDURE INITIALLY( "END_PROCEDURE" );
GLOBAL SCL_EXPRESS_EXPORT char * KW_END_REPEAT INITIALLY( "END_REPEAT" );
GLOBAL SCL_EXPRESS_EXPORT char * KW_END_RULE INITIALLY( "END_RULE" );
GLOBAL SCL_EXPRESS_EXPORT char * KW_END_SCHEMA INITIALLY( "END_SCHEMA" );
GLOBAL SCL_EXPRESS_EXPORT char * KW_END_TYPE INITIALLY( "END_TYPE" );
GLOBAL SCL_EXPRESS_EXPORT char * KW_ENTITY INITIALLY( "ENTITY" );
GLOBAL SCL_EXPRESS_EXPORT char * KW_ENUMERATION INITIALLY( "ENUMERATION" );
GLOBAL SCL_EXPRESS_EXPORT char * KW_ESCAPE INITIALLY( "ESCAPE" );
GLOBAL SCL_EXPRESS_EXPORT char * KW_EXISTS INITIALLY( "EXISTS" );
GLOBAL SCL_EXPRESS_EXPORT char * KW_EXP INITIALLY( "EXP" );
GLOBAL SCL_EXPRESS_EXPORT char * KW_FALSE INITIALLY( "FALSE" );
GLOBAL SCL_EXPRESS_EXPORT char * KW_FIXED INITIALLY( "FIXED" );
GLOBAL SCL_EXPRESS_EXPORT char * KW_FOR INITIALLY( "FOR" );
GLOBAL SCL_EXPRESS_EXPORT char * KW_FORMAT INITIALLY( "FORMAT" );
GLOBAL SCL_EXPRESS_EXPORT char * KW_FROM INITIALLY( "FROM" );
GLOBAL SCL_EXPRESS_EXPORT char * KW_FUNCTION INITIALLY( "FUNCTION" );
GLOBAL SCL_EXPRESS_EXPORT char * KW_GENERIC INITIALLY( "GENERIC" );
GLOBAL SCL_EXPRESS_EXPORT char * KW_HIBOUND INITIALLY( "HIBOUND" );
GLOBAL SCL_EXPRESS_EXPORT char * KW_HIINDEX INITIALLY( "HIINDEX" );
GLOBAL SCL_EXPRESS_EXPORT char * KW_IF INITIALLY( "IF" );
GLOBAL SCL_EXPRESS_EXPORT char * KW_IN INITIALLY( "IN" );
GLOBAL SCL_EXPRESS_EXPORT char * KW_INCLUDE INITIALLY( "INCLUDE" );
GLOBAL SCL_EXPRESS_EXPORT char * KW_INSERT INITIALLY( "INSERT" );
GLOBAL SCL_EXPRESS_EXPORT char * KW_INTEGER INITIALLY( "INTEGER" );
GLOBAL SCL_EXPRESS_EXPORT char * KW_INVERSE INITIALLY( "INVERSE" );
GLOBAL SCL_EXPRESS_EXPORT char * KW_LENGTH INITIALLY( "LENGTH" );
GLOBAL SCL_EXPRESS_EXPORT char * KW_LIKE INITIALLY( "LIKE" );
GLOBAL SCL_EXPRESS_EXPORT char * KW_LIST INITIALLY( "LIST" );
GLOBAL SCL_EXPRESS_EXPORT char * KW_LOBOUND INITIALLY( "LOBOUND" );
GLOBAL SCL_EXPRESS_EXPORT char * KW_LOCAL INITIALLY( "LOCAL" );
GLOBAL SCL_EXPRESS_EXPORT char * KW_LOG INITIALLY( "LOG" );
GLOBAL SCL_EXPRESS_EXPORT char * KW_LOG10 INITIALLY( "LOG10" );
GLOBAL SCL_EXPRESS_EXPORT char * KW_LOG2 INITIALLY( "LOG2" );
GLOBAL SCL_EXPRESS_EXPORT char * KW_LOGICAL INITIALLY( "LOGICAL" );
GLOBAL SCL_EXPRESS_EXPORT char * KW_LOINDEX INITIALLY( "LOINDEX" );
GLOBAL SCL_EXPRESS_EXPORT char * KW_MOD INITIALLY( "MOD" );
GLOBAL SCL_EXPRESS_EXPORT char * KW_MODEL INITIALLY( "MODEL" );
GLOBAL SCL_EXPRESS_EXPORT char * KW_NOT INITIALLY( "NOT" );
GLOBAL SCL_EXPRESS_EXPORT char * KW_NUMBER INITIALLY( "NUMBER" );
GLOBAL SCL_EXPRESS_EXPORT char * KW_NVL INITIALLY( "NVL" );
GLOBAL SCL_EXPRESS_EXPORT char * KW_ODD INITIALLY( "ODD" );
GLOBAL SCL_EXPRESS_EXPORT char * KW_OF INITIALLY( "OF" );
GLOBAL SCL_EXPRESS_EXPORT char * KW_ONEOF INITIALLY( "ONEOF" );
GLOBAL SCL_EXPRESS_EXPORT char * KW_OPTIONAL INITIALLY( "OPTIONAL" );
GLOBAL SCL_EXPRESS_EXPORT char * KW_OR INITIALLY( "OR" );
GLOBAL SCL_EXPRESS_EXPORT char * KW_OTHERWISE INITIALLY( "OTHERWISE" );
GLOBAL SCL_EXPRESS_EXPORT char * KW_PI INITIALLY( "PI" );
GLOBAL SCL_EXPRESS_EXPORT char * KW_PROCEDURE INITIALLY( "PROCEDURE" );
GLOBAL SCL_EXPRESS_EXPORT char * KW_QUERY INITIALLY( "QUERY" );
GLOBAL SCL_EXPRESS_EXPORT char * KW_REAL INITIALLY( "REAL" );
GLOBAL SCL_EXPRESS_EXPORT char * KW_REFERENCE INITIALLY( "REFERENCE" );
GLOBAL SCL_EXPRESS_EXPORT char * KW_REMOVE INITIALLY( "REMOVE" );
GLOBAL SCL_EXPRESS_EXPORT char * KW_REPEAT INITIALLY( "REPEAT" );
GLOBAL SCL_EXPRESS_EXPORT char * KW_RETURN INITIALLY( "RETURN" );
GLOBAL SCL_EXPRESS_EXPORT char * KW_ROLESOF INITIALLY( "ROLESOF" );
GLOBAL SCL_EXPRESS_EXPORT char * KW_RULE INITIALLY( "RULE" );
GLOBAL SCL_EXPRESS_EXPORT char * KW_SCHEMA INITIALLY( "SCHEMA" );
GLOBAL SCL_EXPRESS_EXPORT char * KW_SELECT INITIALLY( "SELECT" );
GLOBAL SCL_EXPRESS_EXPORT char * KW_SELF INITIALLY( "SELF" );
GLOBAL SCL_EXPRESS_EXPORT char * KW_SET INITIALLY( "SET" );
GLOBAL SCL_EXPRESS_EXPORT char * KW_SIN INITIALLY( "SIN" );
GLOBAL SCL_EXPRESS_EXPORT char * KW_SIZEOF INITIALLY( "SIZEOF" );
GLOBAL SCL_EXPRESS_EXPORT char * KW_SKIP INITIALLY( "SKIP" );
GLOBAL SCL_EXPRESS_EXPORT char * KW_SQRT INITIALLY( "SQRT" );
GLOBAL SCL_EXPRESS_EXPORT char * KW_STRING INITIALLY( "STRING" );
GLOBAL SCL_EXPRESS_EXPORT char * KW_SUBTYPE INITIALLY( "SUBTYPE" );
GLOBAL SCL_EXPRESS_EXPORT char * KW_SUPERTYPE INITIALLY( "SUPERTYPE" );
GLOBAL SCL_EXPRESS_EXPORT char * KW_TAN INITIALLY( "TAN" );
GLOBAL SCL_EXPRESS_EXPORT char * KW_THEN INITIALLY( "THEN" );
GLOBAL SCL_EXPRESS_EXPORT char * KW_TO INITIALLY( "TO" );
GLOBAL SCL_EXPRESS_EXPORT char * KW_TRUE INITIALLY( "TRUE" );
GLOBAL SCL_EXPRESS_EXPORT char * KW_TYPE INITIALLY( "TYPE" );
GLOBAL SCL_EXPRESS_EXPORT char * KW_TYPEOF INITIALLY( "TYPEOF" );
GLOBAL SCL_EXPRESS_EXPORT char * KW_UNIQUE INITIALLY( "UNIQUE" );
GLOBAL SCL_EXPRESS_EXPORT char * KW_UNKNOWN INITIALLY( "UNKNOWN" );
GLOBAL SCL_EXPRESS_EXPORT char * KW_UNTIL INITIALLY( "UNTIL" );
GLOBAL SCL_EXPRESS_EXPORT char * KW_USE INITIALLY( "USE" );
GLOBAL SCL_EXPRESS_EXPORT char * KW_USEDIN INITIALLY( "USEDIN" );
GLOBAL SCL_EXPRESS_EXPORT char * KW_VALUE INITIALLY( "VALUE" );
GLOBAL SCL_EXPRESS_EXPORT char * KW_VALUE_IN INITIALLY( "VALUE_IN" );
GLOBAL SCL_EXPRESS_EXPORT char * KW_VALUE_UNIQUE INITIALLY( "VALUE_UNIQUE" );
GLOBAL SCL_EXPRESS_EXPORT char * KW_VAR INITIALLY( "VAR" );
GLOBAL SCL_EXPRESS_EXPORT char * KW_WHERE INITIALLY( "WHERE" );
GLOBAL SCL_EXPRESS_EXPORT char * KW_WHILE INITIALLY( "WHILE" );
GLOBAL SCL_EXPRESS_EXPORT char * KW_XOR INITIALLY( "XOR" );
#undef GLOBAL
#undef INITIALLY
extern SCL_EXPRESS_EXPORT char * KW_ABS;
extern SCL_EXPRESS_EXPORT char * KW_ABSTRACT;
extern SCL_EXPRESS_EXPORT char * KW_ACOS;
extern SCL_EXPRESS_EXPORT char * KW_AGGREGATE;
extern SCL_EXPRESS_EXPORT char * KW_ALIAS;
extern SCL_EXPRESS_EXPORT char * KW_AND;
extern SCL_EXPRESS_EXPORT char * KW_ANDOR;
extern SCL_EXPRESS_EXPORT char * KW_ARRAY;
extern SCL_EXPRESS_EXPORT char * KW_AS;
extern SCL_EXPRESS_EXPORT char * KW_ASIN;
extern SCL_EXPRESS_EXPORT char * KW_ATAN;
extern SCL_EXPRESS_EXPORT char * KW_BAG;
extern SCL_EXPRESS_EXPORT char * KW_BEGIN;
extern SCL_EXPRESS_EXPORT char * KW_BINARY;
extern SCL_EXPRESS_EXPORT char * KW_BLENGTH;
extern SCL_EXPRESS_EXPORT char * KW_BOOLEAN;
extern SCL_EXPRESS_EXPORT char * KW_BY;
extern SCL_EXPRESS_EXPORT char * KW_CASE;
extern SCL_EXPRESS_EXPORT char * KW_CONST_E;
extern SCL_EXPRESS_EXPORT char * KW_CONSTANT;
extern SCL_EXPRESS_EXPORT char * KW_CONTEXT;
extern SCL_EXPRESS_EXPORT char * KW_COS;
extern SCL_EXPRESS_EXPORT char * KW_DERIVE;
extern SCL_EXPRESS_EXPORT char * KW_DIV;
extern SCL_EXPRESS_EXPORT char * KW_ELSE;
extern SCL_EXPRESS_EXPORT char * KW_END;
extern SCL_EXPRESS_EXPORT char * KW_END_ALIAS;
extern SCL_EXPRESS_EXPORT char * KW_END_CASE;
extern SCL_EXPRESS_EXPORT char * KW_END_CONSTANT;
extern SCL_EXPRESS_EXPORT char * KW_END_CONTEXT;
extern SCL_EXPRESS_EXPORT char * KW_END_ENTITY;
extern SCL_EXPRESS_EXPORT char * KW_END_FUNCTION;
extern SCL_EXPRESS_EXPORT char * KW_END_IF;
extern SCL_EXPRESS_EXPORT char * KW_END_LOCAL;
extern SCL_EXPRESS_EXPORT char * KW_END_MODEL;
extern SCL_EXPRESS_EXPORT char * KW_END_PROCEDURE;
extern SCL_EXPRESS_EXPORT char * KW_END_REPEAT;
extern SCL_EXPRESS_EXPORT char * KW_END_RULE;
extern SCL_EXPRESS_EXPORT char * KW_END_SCHEMA;
extern SCL_EXPRESS_EXPORT char * KW_END_TYPE;
extern SCL_EXPRESS_EXPORT char * KW_ENTITY;
extern SCL_EXPRESS_EXPORT char * KW_ENUMERATION;
extern SCL_EXPRESS_EXPORT char * KW_ESCAPE;
extern SCL_EXPRESS_EXPORT char * KW_EXISTS;
extern SCL_EXPRESS_EXPORT char * KW_EXP;
extern SCL_EXPRESS_EXPORT char * KW_FALSE;
extern SCL_EXPRESS_EXPORT char * KW_FIXED;
extern SCL_EXPRESS_EXPORT char * KW_FOR;
extern SCL_EXPRESS_EXPORT char * KW_FORMAT;
extern SCL_EXPRESS_EXPORT char * KW_FROM;
extern SCL_EXPRESS_EXPORT char * KW_FUNCTION;
extern SCL_EXPRESS_EXPORT char * KW_GENERIC;
extern SCL_EXPRESS_EXPORT char * KW_HIBOUND;
extern SCL_EXPRESS_EXPORT char * KW_HIINDEX;
extern SCL_EXPRESS_EXPORT char * KW_IF;
extern SCL_EXPRESS_EXPORT char * KW_IN;
extern SCL_EXPRESS_EXPORT char * KW_INCLUDE;
extern SCL_EXPRESS_EXPORT char * KW_INSERT;
extern SCL_EXPRESS_EXPORT char * KW_INTEGER;
extern SCL_EXPRESS_EXPORT char * KW_INVERSE;
extern SCL_EXPRESS_EXPORT char * KW_LENGTH;
extern SCL_EXPRESS_EXPORT char * KW_LIKE;
extern SCL_EXPRESS_EXPORT char * KW_LIST;
extern SCL_EXPRESS_EXPORT char * KW_LOBOUND;
extern SCL_EXPRESS_EXPORT char * KW_LOCAL;
extern SCL_EXPRESS_EXPORT char * KW_LOG;
extern SCL_EXPRESS_EXPORT char * KW_LOG10;
extern SCL_EXPRESS_EXPORT char * KW_LOG2;
extern SCL_EXPRESS_EXPORT char * KW_LOGICAL;
extern SCL_EXPRESS_EXPORT char * KW_LOINDEX;
extern SCL_EXPRESS_EXPORT char * KW_MOD;
extern SCL_EXPRESS_EXPORT char * KW_MODEL;
extern SCL_EXPRESS_EXPORT char * KW_NOT;
extern SCL_EXPRESS_EXPORT char * KW_NUMBER;
extern SCL_EXPRESS_EXPORT char * KW_NVL;
extern SCL_EXPRESS_EXPORT char * KW_ODD;
extern SCL_EXPRESS_EXPORT char * KW_OF;
extern SCL_EXPRESS_EXPORT char * KW_ONEOF;
extern SCL_EXPRESS_EXPORT char * KW_OPTIONAL;
extern SCL_EXPRESS_EXPORT char * KW_OR;
extern SCL_EXPRESS_EXPORT char * KW_OTHERWISE;
extern SCL_EXPRESS_EXPORT char * KW_PI;
extern SCL_EXPRESS_EXPORT char * KW_PROCEDURE;
extern SCL_EXPRESS_EXPORT char * KW_QUERY;
extern SCL_EXPRESS_EXPORT char * KW_REAL;
extern SCL_EXPRESS_EXPORT char * KW_REFERENCE;
extern SCL_EXPRESS_EXPORT char * KW_REMOVE;
extern SCL_EXPRESS_EXPORT char * KW_REPEAT;
extern SCL_EXPRESS_EXPORT char * KW_RETURN;
extern SCL_EXPRESS_EXPORT char * KW_ROLESOF;
extern SCL_EXPRESS_EXPORT char * KW_RULE;
extern SCL_EXPRESS_EXPORT char * KW_SCHEMA;
extern SCL_EXPRESS_EXPORT char * KW_SELECT;
extern SCL_EXPRESS_EXPORT char * KW_SELF;
extern SCL_EXPRESS_EXPORT char * KW_SET;
extern SCL_EXPRESS_EXPORT char * KW_SIN;
extern SCL_EXPRESS_EXPORT char * KW_SIZEOF;
extern SCL_EXPRESS_EXPORT char * KW_SKIP;
extern SCL_EXPRESS_EXPORT char * KW_SQRT;
extern SCL_EXPRESS_EXPORT char * KW_STRING;
extern SCL_EXPRESS_EXPORT char * KW_SUBTYPE;
extern SCL_EXPRESS_EXPORT char * KW_SUPERTYPE;
extern SCL_EXPRESS_EXPORT char * KW_TAN;
extern SCL_EXPRESS_EXPORT char * KW_THEN;
extern SCL_EXPRESS_EXPORT char * KW_TO;
extern SCL_EXPRESS_EXPORT char * KW_TRUE;
extern SCL_EXPRESS_EXPORT char * KW_TYPE;
extern SCL_EXPRESS_EXPORT char * KW_TYPEOF;
extern SCL_EXPRESS_EXPORT char * KW_UNIQUE;
extern SCL_EXPRESS_EXPORT char * KW_UNKNOWN;
extern SCL_EXPRESS_EXPORT char * KW_UNTIL;
extern SCL_EXPRESS_EXPORT char * KW_USE;
extern SCL_EXPRESS_EXPORT char * KW_USEDIN;
extern SCL_EXPRESS_EXPORT char * KW_VALUE;
extern SCL_EXPRESS_EXPORT char * KW_VALUE_IN;
extern SCL_EXPRESS_EXPORT char * KW_VALUE_UNIQUE;
extern SCL_EXPRESS_EXPORT char * KW_VAR;
extern SCL_EXPRESS_EXPORT char * KW_WHERE;
extern SCL_EXPRESS_EXPORT char * KW_WHILE;
extern SCL_EXPRESS_EXPORT char * KW_XOR;
/******************************/
/* macro function definitions */

View file

@ -101,10 +101,6 @@
/*****************/
#include <scl_export.h>
#ifdef HASH_C
#include <assert.h>
#endif /*HASH_C*/
#include "memory.h"
/************/
@ -135,7 +131,7 @@ typedef struct Hash_Table_ {
#endif
unsigned int p; /**< Next bucket to be split */
unsigned int maxp; /**< upper bound on p during expansion */
long KeyCount; /**< current # keys */
unsigned int KeyCount; /**< current # keys */
unsigned int SegmentCount; /**< current # segments */
unsigned int MinLoadFactor;
unsigned int MaxLoadFactor;
@ -160,19 +156,8 @@ typedef struct {
/* global variables */
/********************/
#ifdef HASH_C
# define GLOBAL
# define INITIALLY(value) = value
#else
# define GLOBAL extern
# define INITIALLY(value)
#endif /*HASH_C*/
GLOBAL SCL_EXPRESS_EXPORT struct freelist_head HASH_Table_fl;
GLOBAL SCL_EXPRESS_EXPORT struct freelist_head HASH_Element_fl;
#undef GLOBAL
#undef INITIALLY
extern SCL_EXPRESS_EXPORT struct freelist_head HASH_Table_fl;
extern SCL_EXPRESS_EXPORT struct freelist_head HASH_Element_fl;
/******************************/
/* macro function definitions */

View file

@ -68,31 +68,19 @@ typedef struct Scan_Buffer {
/* global variables */
/********************/
#ifdef LEX_ACTIONS_C
# define GLOBAL
# define INITIALLY(value) = value
#else
# define GLOBAL extern
# define INITIALLY(value)
#endif /* LEX_ACTIONS_C */
extern SCL_EXPRESS_EXPORT Scan_Buffer SCAN_buffers[SCAN_NESTING_DEPTH];
extern SCL_EXPRESS_EXPORT int SCAN_current_buffer;
extern SCL_EXPRESS_EXPORT char * SCANcurrent;
GLOBAL SCL_EXPRESS_EXPORT Scan_Buffer SCAN_buffers[SCAN_NESTING_DEPTH];
GLOBAL SCL_EXPRESS_EXPORT int SCAN_current_buffer INITIALLY( 0 );
GLOBAL SCL_EXPRESS_EXPORT char * SCANcurrent;
GLOBAL SCL_EXPRESS_EXPORT Error ERROR_include_file INITIALLY( ERROR_none );
GLOBAL SCL_EXPRESS_EXPORT Error ERROR_unmatched_close_comment INITIALLY( ERROR_none );
GLOBAL SCL_EXPRESS_EXPORT Error ERROR_unmatched_open_comment INITIALLY( ERROR_none );
GLOBAL SCL_EXPRESS_EXPORT Error ERROR_unterminated_string INITIALLY( ERROR_none );
GLOBAL SCL_EXPRESS_EXPORT Error ERROR_encoded_string_bad_digit INITIALLY( ERROR_none );
GLOBAL SCL_EXPRESS_EXPORT Error ERROR_encoded_string_bad_count INITIALLY( ERROR_none );
GLOBAL SCL_EXPRESS_EXPORT Error ERROR_bad_identifier INITIALLY( ERROR_none );
GLOBAL SCL_EXPRESS_EXPORT Error ERROR_unexpected_character INITIALLY( ERROR_none );
GLOBAL SCL_EXPRESS_EXPORT Error ERROR_nonascii_char;
#undef GLOBAL
#undef INITIALLY
extern SCL_EXPRESS_EXPORT Error ERROR_include_file;
extern SCL_EXPRESS_EXPORT Error ERROR_unmatched_close_comment;
extern SCL_EXPRESS_EXPORT Error ERROR_unmatched_open_comment;
extern SCL_EXPRESS_EXPORT Error ERROR_unterminated_string;
extern SCL_EXPRESS_EXPORT Error ERROR_encoded_string_bad_digit;
extern SCL_EXPRESS_EXPORT Error ERROR_encoded_string_bad_count;
extern SCL_EXPRESS_EXPORT Error ERROR_bad_identifier;
extern SCL_EXPRESS_EXPORT Error ERROR_unexpected_character;
extern SCL_EXPRESS_EXPORT Error ERROR_nonascii_char;
/******************************/
/* macro function definitions */
@ -111,18 +99,16 @@ GLOBAL SCL_EXPRESS_EXPORT Error ERROR_nonascii_char;
/* function prototypes */
/***********************/
extern SCL_EXPRESS_EXPORT int yylex PROTO( ( void ) ); /* the scanner */
extern SCL_EXPRESS_EXPORT void SCANinitialize PROTO( ( void ) );
extern SCL_EXPRESS_EXPORT int SCANprocess_real_literal PROTO( ( void ) );
extern SCL_EXPRESS_EXPORT int SCANprocess_integer_literal PROTO( ( void ) );
extern SCL_EXPRESS_EXPORT int SCANprocess_binary_literal PROTO( ( void ) );
extern SCL_EXPRESS_EXPORT int SCANprocess_real_literal PROTO( ( const char * ) );
extern SCL_EXPRESS_EXPORT int SCANprocess_integer_literal PROTO( ( const char * ) );
extern SCL_EXPRESS_EXPORT int SCANprocess_binary_literal PROTO( ( const char * ) );
extern SCL_EXPRESS_EXPORT int SCANprocess_logical_literal PROTO( ( char * ) );
extern SCL_EXPRESS_EXPORT int SCANprocess_identifier_or_keyword PROTO( ( void ) );
extern SCL_EXPRESS_EXPORT int SCANprocess_string PROTO( ( void ) );
extern SCL_EXPRESS_EXPORT int SCANprocess_encoded_string PROTO( ( void ) );
extern SCL_EXPRESS_EXPORT int SCANprocess_semicolon PROTO( ( int ) );
extern SCL_EXPRESS_EXPORT void SCANsave_comment PROTO( ( void ) );
extern SCL_EXPRESS_EXPORT int SCANprocess_identifier_or_keyword PROTO( ( const char * ) );
extern SCL_EXPRESS_EXPORT int SCANprocess_string PROTO( ( const char * ) );
extern SCL_EXPRESS_EXPORT int SCANprocess_encoded_string PROTO( ( const char * ) );
extern SCL_EXPRESS_EXPORT int SCANprocess_semicolon PROTO( ( const char *, int ) );
extern SCL_EXPRESS_EXPORT void SCANsave_comment PROTO( ( const char * ) );
extern SCL_EXPRESS_EXPORT bool SCANread PROTO( ( void ) );
#if macros_bit_the_dust
extern SCL_EXPRESS_EXPORT void SCANdefine_macro PROTO( ( char *, char * ) );
@ -133,49 +119,4 @@ SCL_EXPRESS_EXPORT void SCANupperize PROTO( ( char * ) );
extern SCL_EXPRESS_EXPORT char * SCANstrdup PROTO( ( char * ) );
extern SCL_EXPRESS_EXPORT long SCANtell PROTO( ( void ) );
/*******************************/
/* inline function definitions */
/*******************************/
#if supports_inline_functions || defined(LEX_ACTIONS_C)
static_inline
int
SCANnextchar( char * buffer ) {
extern bool SCANread( void );
#ifdef keep_nul
static int escaped = 0;
#endif
if( SCANtext_ready || SCANread() ) {
#ifdef keep_nul
if( !*SCANcurrent ) {
buffer[0] = SCAN_ESCAPE;
*SCANcurrent = '0';
return 1;
} else if( ( *SCANcurrent == SCAN_ESCAPE ) && !escaped ) {
escaped = 1;
buffer[0] = SCAN_ESCAPE;
return 1;
}
SCANbuffer.numRead--;
#endif
buffer[0] = *( SCANcurrent++ );
#ifdef __MSVC__
if( !__isascii( buffer[0] ) ) {
#else
if( !isascii( buffer[0] ) ) {
#endif
ERRORreport_with_line( ERROR_nonascii_char, yylineno,
0xff & buffer[0] );
buffer[0] = ' '; /* substitute space */
}
return 1;
} else {
return 0;
}
}
#endif /* supports_inline_functions || defined(LEX_ACTIONS_C) */
#endif /* LEX_ACTIONS_H */

View file

@ -70,18 +70,10 @@ struct Linked_List_ {
/* global variables */
/********************/
#ifdef LINKED_LIST_C
#include "defstart.h"
#else
#include "decstart.h"
#endif /*LINKED_LIST_C*/
GLOBAL SCL_EXPRESS_EXPORT Error ERROR_empty_list INITIALLY( ERROR_none );
GLOBAL SCL_EXPRESS_EXPORT struct freelist_head LINK_fl;
GLOBAL SCL_EXPRESS_EXPORT struct freelist_head LIST_fl;
GLOBAL SCL_EXPRESS_EXPORT Linked_List LINK__l; /* for LISTcreate_with macro - ugh */
#include "de_end.h"
extern SCL_EXPRESS_EXPORT Error ERROR_empty_list;
extern SCL_EXPRESS_EXPORT struct freelist_head LINK_fl;
extern SCL_EXPRESS_EXPORT struct freelist_head LIST_fl;
extern SCL_EXPRESS_EXPORT Linked_List LINK__l; /* for LISTcreate_with macro - ugh */
/******************************/
/* macro function definitions */
@ -149,33 +141,6 @@ extern SCL_EXPRESS_EXPORT Generic LISTget_second PROTO( ( Linked_List ) );
extern SCL_EXPRESS_EXPORT Generic LISTget_nth PROTO( ( Linked_List, int ) );
extern SCL_EXPRESS_EXPORT void LISTfree PROTO( ( Linked_List ) );
extern SCL_EXPRESS_EXPORT int LISTget_length PROTO( ( Linked_List ) );
/*******************************/
/* inline function definitions */
/*******************************/
#if !defined(__BORLAND__)
#if supports_inline_functions || defined(LINKED_LIST_C)
static_inline
bool
LISTempty( Linked_List list ) {
if( !list ) {
return true;
}
if( list->mark->next == list->mark ) {
return true;
}
return false;
}
#endif /* supports_inline_functions || defined(LINKED_LIST_C) */
#else
extern SCL_EXPRESS_EXPORT bool LISTempty( Linked_List list );
#endif
#endif /*LINKED_LIST_H*/

View file

@ -62,18 +62,11 @@ char * nnew();
#include "error.h"
/* should be MEMORY_C but there is none, so we'll tie it to express.c */
#ifdef EXPRESS_C
#include "defstart.h"
#else
#include "decstart.h"
#endif /* EXPRESS_C */
/***********************************************/
/* space allocation macros with error package: */
/***********************************************/
extern int yylineno;
extern SCL_EXPRESS_EXPORT int yylineno;
/** CALLOC grabs and initializes to all 0s space for the indicated
* number of instances of the indicated type */
@ -87,8 +80,6 @@ SCL_EXPRESS_EXPORT void MEMinitialize PROTO( ( struct freelist_head *, int, i
SCL_EXPRESS_EXPORT void MEM_destroy PROTO( ( struct freelist_head *, Freelist * ) );
SCL_EXPRESS_EXPORT Generic MEM_new PROTO( ( struct freelist_head * ) );
#include "de_end.h"
#endif /* MEMORY_H */

View file

@ -81,15 +81,7 @@ struct Object {
/* global variables */
/********************/
#ifdef OBJECT_C
#include "defstart.h"
#else
#include "decstart.h"
#endif /*OBJECT_C */
GLOBAL SCL_EXPRESS_EXPORT struct Object * OBJ;
#include "de_end.h"
extern SCL_EXPRESS_EXPORT struct Object * OBJ;
/******************************/
/* macro function definitions */
@ -101,8 +93,6 @@ GLOBAL SCL_EXPRESS_EXPORT struct Object * OBJ;
#define OBJtype_is_oneof(_type_,class) (OBJ[(int)_type_].bits & (class))
#define OBJget_name(obj,type) (OBJget_symbol(obj,type)->name)
/* removed #define statements for obsolete fn macros OBJequal OBJfree OBJreference OBJget_data */
/***********************/
/* function prototypes */
/***********************/

View file

@ -45,31 +45,17 @@
/* global variables */
/********************/
#ifdef RESOLVE_C
# define GLOBAL
# define INITIALLY(value) = value
#else
# define GLOBAL extern
# define INITIALLY(value)
#endif /*RESOLVE_C*/
extern SCL_EXPRESS_EXPORT int print_objects_while_running;
GLOBAL SCL_EXPRESS_EXPORT int print_objects_while_running INITIALLY( 0 );
GLOBAL SCL_EXPRESS_EXPORT Error ERROR_undefined_attribute INITIALLY( ERROR_none );
GLOBAL SCL_EXPRESS_EXPORT Error ERROR_undefined_type INITIALLY( ERROR_none );
GLOBAL SCL_EXPRESS_EXPORT Error ERROR_undefined_schema INITIALLY( ERROR_none );
GLOBAL SCL_EXPRESS_EXPORT Error ERROR_unknown_attr_in_entity INITIALLY( ERROR_none );
GLOBAL SCL_EXPRESS_EXPORT Error ERROR_unknown_subtype INITIALLY( ERROR_none );
GLOBAL SCL_EXPRESS_EXPORT Error ERROR_unknown_supertype INITIALLY( ERROR_none );
GLOBAL SCL_EXPRESS_EXPORT Error ERROR_circular_reference INITIALLY( ERROR_none );
GLOBAL SCL_EXPRESS_EXPORT Error ERROR_ambiguous_attribute INITIALLY( ERROR_none );
GLOBAL SCL_EXPRESS_EXPORT Error ERROR_ambiguous_group INITIALLY( ERROR_none );
GLOBAL SCL_EXPRESS_EXPORT Error WARNING_case_skip_label INITIALLY( ERROR_none );
GLOBAL SCL_EXPRESS_EXPORT Error WARNING_fn_skip_branch INITIALLY( ERROR_none );
#undef GLOBAL
#undef INITIALLY
extern SCL_EXPRESS_EXPORT Error ERROR_undefined_attribute;
extern SCL_EXPRESS_EXPORT Error ERROR_undefined_type;
extern SCL_EXPRESS_EXPORT Error ERROR_undefined_schema;
extern SCL_EXPRESS_EXPORT Error ERROR_unknown_attr_in_entity;
extern SCL_EXPRESS_EXPORT Error ERROR_unknown_subtype;
extern SCL_EXPRESS_EXPORT Error ERROR_unknown_supertype;
extern SCL_EXPRESS_EXPORT Error ERROR_circular_reference;
extern SCL_EXPRESS_EXPORT Error ERROR_ambiguous_attribute;
extern SCL_EXPRESS_EXPORT Error ERROR_ambiguous_group;
/* macros */

View file

@ -104,22 +104,11 @@ struct Schema_ {
/* global variables */
/********************/
#ifdef SCHEMA_C
# define GLOBAL
# define INITIALLY(value) = value
#else
# define GLOBAL extern
# define INITIALLY(value)
#endif /* SCHEMA_C */
extern SCL_EXPRESS_EXPORT struct freelist_head REN_fl;
extern SCL_EXPRESS_EXPORT struct freelist_head SCOPE_fl;
extern SCL_EXPRESS_EXPORT struct freelist_head SCHEMA_fl;
GLOBAL SCL_EXPRESS_EXPORT struct freelist_head REN_fl;
GLOBAL SCL_EXPRESS_EXPORT struct freelist_head SCOPE_fl;
GLOBAL SCL_EXPRESS_EXPORT struct freelist_head SCHEMA_fl;
GLOBAL SCL_EXPRESS_EXPORT int __SCOPE_search_id INITIALLY( 0 );
#undef GLOBAL
#undef INITIALLY
extern SCL_EXPRESS_EXPORT int __SCOPE_search_id;
/******************************/
/* macro function definitions */
@ -161,4 +150,3 @@ extern SCL_EXPRESS_EXPORT Linked_List SCHEMAget_entities_ref PROTO( ( Scope ) );
#endif /* SCHEMA_H */

View file

@ -99,17 +99,6 @@ struct Scope_ {
Linked_List where; /**< optional where clause */
};
/********************/
/* global variables */
/********************/
#ifdef SCOPE_C
#include "defstart.h"
#else
#include "decstart.h"
#endif /* SCOPE_C */
#include "de_end.h"
/******************************/
/* macro function definitions */
/******************************/

View file

@ -164,28 +164,20 @@ struct Return_Statement_ {
/* global variables */
/********************/
#ifdef STATEMENT_C
#include "defstart.h"
#else
#include "decstart.h"
#endif /*STATEMENT_C*/
extern SCL_EXPRESS_EXPORT struct freelist_head STMT_fl;
GLOBAL SCL_EXPRESS_EXPORT struct freelist_head STMT_fl;
extern SCL_EXPRESS_EXPORT struct freelist_head ALIAS_fl;
extern SCL_EXPRESS_EXPORT struct freelist_head ASSIGN_fl;
extern SCL_EXPRESS_EXPORT struct freelist_head CASE_fl;
extern SCL_EXPRESS_EXPORT struct freelist_head COMP_STMT_fl;
extern SCL_EXPRESS_EXPORT struct freelist_head COND_fl;
extern SCL_EXPRESS_EXPORT struct freelist_head LOOP_fl;
extern SCL_EXPRESS_EXPORT struct freelist_head PCALL_fl;
extern SCL_EXPRESS_EXPORT struct freelist_head RET_fl;
extern SCL_EXPRESS_EXPORT struct freelist_head INCR_fl;
GLOBAL SCL_EXPRESS_EXPORT struct freelist_head ALIAS_fl;
GLOBAL SCL_EXPRESS_EXPORT struct freelist_head ASSIGN_fl;
GLOBAL SCL_EXPRESS_EXPORT struct freelist_head CASE_fl;
GLOBAL SCL_EXPRESS_EXPORT struct freelist_head COMP_STMT_fl;
GLOBAL SCL_EXPRESS_EXPORT struct freelist_head COND_fl;
GLOBAL SCL_EXPRESS_EXPORT struct freelist_head LOOP_fl;
GLOBAL SCL_EXPRESS_EXPORT struct freelist_head PCALL_fl;
GLOBAL SCL_EXPRESS_EXPORT struct freelist_head RET_fl;
GLOBAL SCL_EXPRESS_EXPORT struct freelist_head INCR_fl;
GLOBAL SCL_EXPRESS_EXPORT Statement STATEMENT_ESCAPE INITIALLY( STATEMENT_NULL );
GLOBAL SCL_EXPRESS_EXPORT Statement STATEMENT_SKIP INITIALLY( STATEMENT_NULL );
#include "de_end.h"
extern SCL_EXPRESS_EXPORT Statement STATEMENT_ESCAPE;
extern SCL_EXPRESS_EXPORT Statement STATEMENT_SKIP;
/******************************/
/* macro function definitions */

View file

@ -60,7 +60,7 @@ typedef struct Symbol_ Symbol;
struct Symbol_ {
char * name;
char * filename;
unsigned int line;
int line;
char resolved;
};
@ -72,15 +72,7 @@ struct Symbol_ {
/* global variables */
/********************/
#ifdef SYMBOL_C
#include "defstart.h"
#else
#include "decstart.h"
#endif /* SYMBOL_C */
GLOBAL SCL_EXPRESS_EXPORT struct freelist_head SYMBOL_fl;
#include "de_end.h"
extern SCL_EXPRESS_EXPORT struct freelist_head SYMBOL_fl;
/******************************/
/* macro function definitions */
@ -96,8 +88,7 @@ GLOBAL SCL_EXPRESS_EXPORT struct freelist_head SYMBOL_fl;
/* function prototypes */
/***********************/
extern SCL_EXPRESS_EXPORT void SYMBOLinitialize( void );
extern SCL_EXPRESS_EXPORT void SYMBOLinitialize PROTO( ( void ) );
SCL_EXPRESS_EXPORT Symbol * SYMBOLcreate( char * name, int line, char * filename );
#endif /* SYMBOL_H */

View file

@ -176,51 +176,43 @@ struct TypeBody_ {
/* global variables */
/********************/
#ifdef TYPE_C
#include "defstart.h"
#else
#include "decstart.h"
#endif /* TYPE_C */
/* Very commonly-used read-only types */
/* non-constant versions probably aren't necessary? */
GLOBAL SCL_EXPRESS_EXPORT Type Type_Bad;
GLOBAL SCL_EXPRESS_EXPORT Type Type_Unknown;
GLOBAL SCL_EXPRESS_EXPORT Type Type_Dont_Care;
GLOBAL SCL_EXPRESS_EXPORT Type Type_Runtime; /**< indicates that this object can't be
extern SCL_EXPRESS_EXPORT Type Type_Bad;
extern SCL_EXPRESS_EXPORT Type Type_Unknown;
extern SCL_EXPRESS_EXPORT Type Type_Dont_Care;
extern SCL_EXPRESS_EXPORT Type Type_Runtime; /**< indicates that this object can't be
calculated now but must be deferred
until (the mythical) runtime */
GLOBAL SCL_EXPRESS_EXPORT Type Type_Binary;
GLOBAL SCL_EXPRESS_EXPORT Type Type_Boolean;
GLOBAL SCL_EXPRESS_EXPORT Type Type_Enumeration;
GLOBAL SCL_EXPRESS_EXPORT Type Type_Expression;
GLOBAL SCL_EXPRESS_EXPORT Type Type_Aggregate;
GLOBAL SCL_EXPRESS_EXPORT Type Type_Integer;
GLOBAL SCL_EXPRESS_EXPORT Type Type_Integer;
GLOBAL SCL_EXPRESS_EXPORT Type Type_Number;
GLOBAL SCL_EXPRESS_EXPORT Type Type_Real;
GLOBAL SCL_EXPRESS_EXPORT Type Type_String;
GLOBAL SCL_EXPRESS_EXPORT Type Type_String_Encoded;
GLOBAL SCL_EXPRESS_EXPORT Type Type_Logical;
GLOBAL SCL_EXPRESS_EXPORT Type Type_Set;
GLOBAL SCL_EXPRESS_EXPORT Type Type_Attribute;
GLOBAL SCL_EXPRESS_EXPORT Type Type_Entity;
GLOBAL SCL_EXPRESS_EXPORT Type Type_Funcall;
GLOBAL SCL_EXPRESS_EXPORT Type Type_Generic;
GLOBAL SCL_EXPRESS_EXPORT Type Type_Identifier;
GLOBAL SCL_EXPRESS_EXPORT Type Type_Oneof;
GLOBAL SCL_EXPRESS_EXPORT Type Type_Query;
GLOBAL SCL_EXPRESS_EXPORT Type Type_Self;
GLOBAL SCL_EXPRESS_EXPORT Type Type_Set_Of_String;
GLOBAL SCL_EXPRESS_EXPORT Type Type_Set_Of_Generic;
GLOBAL SCL_EXPRESS_EXPORT Type Type_Bag_Of_Generic;
extern SCL_EXPRESS_EXPORT Type Type_Binary;
extern SCL_EXPRESS_EXPORT Type Type_Boolean;
extern SCL_EXPRESS_EXPORT Type Type_Enumeration;
extern SCL_EXPRESS_EXPORT Type Type_Expression;
extern SCL_EXPRESS_EXPORT Type Type_Aggregate;
extern SCL_EXPRESS_EXPORT Type Type_Integer;
extern SCL_EXPRESS_EXPORT Type Type_Integer;
extern SCL_EXPRESS_EXPORT Type Type_Number;
extern SCL_EXPRESS_EXPORT Type Type_Real;
extern SCL_EXPRESS_EXPORT Type Type_String;
extern SCL_EXPRESS_EXPORT Type Type_String_Encoded;
extern SCL_EXPRESS_EXPORT Type Type_Logical;
extern SCL_EXPRESS_EXPORT Type Type_Set;
extern SCL_EXPRESS_EXPORT Type Type_Attribute;
extern SCL_EXPRESS_EXPORT Type Type_Entity;
extern SCL_EXPRESS_EXPORT Type Type_Funcall;
extern SCL_EXPRESS_EXPORT Type Type_Generic;
extern SCL_EXPRESS_EXPORT Type Type_Identifier;
extern SCL_EXPRESS_EXPORT Type Type_Oneof;
extern SCL_EXPRESS_EXPORT Type Type_Query;
extern SCL_EXPRESS_EXPORT Type Type_Self;
extern SCL_EXPRESS_EXPORT Type Type_Set_Of_String;
extern SCL_EXPRESS_EXPORT Type Type_Set_Of_Generic;
extern SCL_EXPRESS_EXPORT Type Type_Bag_Of_Generic;
GLOBAL SCL_EXPRESS_EXPORT struct freelist_head TYPEHEAD_fl;
GLOBAL SCL_EXPRESS_EXPORT struct freelist_head TYPEBODY_fl;
extern SCL_EXPRESS_EXPORT struct freelist_head TYPEHEAD_fl;
extern SCL_EXPRESS_EXPORT struct freelist_head TYPEBODY_fl;
GLOBAL SCL_EXPRESS_EXPORT Error ERROR_corrupted_type INITIALLY( ERROR_none );
#include "de_end.h"
extern SCL_EXPRESS_EXPORT Error ERROR_corrupted_type;
/******************************/
/* macro function definitions */

View file

@ -99,15 +99,7 @@ struct Variable_ {
/* global variables */
/********************/
#ifdef VARIABLE_C
#include "defstart.h"
#else
#include "decstart.h"
#endif /* VARIABLE_C */
GLOBAL SCL_EXPRESS_EXPORT struct freelist_head VAR_fl;
#include "de_end.h"
extern SCL_EXPRESS_EXPORT struct freelist_head VAR_fl;
/******************************/
/* macro function definitions */

View file

@ -13,7 +13,6 @@
#cmakedefine HAVE_PROCESS_H 1
#cmakedefine HAVE_IO_H 1
#cmakedefine YYTEXT_POINTER 1
#cmakedefine SCL_TRACE_FPRINTF 1
#cmakedefine SCL_MEMMGR_ENABLE_CHECKS 1

View file

@ -43,7 +43,6 @@ typedef int _Bool;
*/
#ifndef __bool_true_false_are_defined
#define bool _Bool
#define Boolean _Bool
#define false 0
#define true 1
#define __bool_true_false_are_defined 1

View file

@ -10,6 +10,10 @@ if(MINGW OR MSVC OR BORLAND)
add_definitions( -DSCL_BASE_DLL_EXPORTS )
endif()
if (${SCL_MEMMGR_ENABLE_CHECKS})
add_definitions( -DSCL_MEMMGR_ENABLE_CHECKS )
endif()
SCL_ADDLIB(base "${SCL_BASE_SOURCES}" "")
if(MINGW OR MSVC OR BORLAND)

View file

@ -2,6 +2,9 @@
#define SCL_MEMMGR_H
#include <scl_export.h>
#include <stdlib.h>
#if defined(SCL_MEMMGR_ENABLE_CHECKS)
/**
Platform specific defines
@ -77,4 +80,11 @@ inline void operator delete[]( void * addr ) THROW_EMPTY {
#endif /* SCL_MEMMGR_CC */
#else
#define scl_malloc(size) malloc(size)
#define scl_calloc(count, size) calloc(count, size)
#define scl_realloc(addr, size) realloc(addr, size)
#define scl_free(addr) free(addr)
#endif /* SCL_MEMMGR_ENABLE_CHECKS */
#endif /* SCL_MEMMGR_H */

View file

@ -74,7 +74,7 @@ SdaiColor_var::operator Color() const {
}
SCLP23( Enum ) *
SDAI_Enum *
create_SdaiColor_var() {
return new SdaiColor_var( "", example_schemat_color );
}
@ -117,11 +117,11 @@ SdaiPoly_line::SdaiPoly_line( ) {
attributes.push( a );
}
SdaiPoly_line::SdaiPoly_line( SdaiPoly_line & e ) {
CopyAs( ( SCLP23( Application_instance_ptr ) ) &e );
CopyAs( ( SDAI_Application_instance_ptr ) &e );
}
SdaiPoly_line::~SdaiPoly_line() { }
SdaiPoly_line::SdaiPoly_line( SCLP23( Application_instance ) *se, int * addAttrs ) {
SdaiPoly_line::SdaiPoly_line( SDAI_Application_instance *se, int * addAttrs ) {
/* Set this to point to the head entity. */
HeadEntity( se );
@ -181,11 +181,11 @@ SdaiShape::SdaiShape( ) {
attributes.push( a );
}
SdaiShape::SdaiShape( SdaiShape & e ) {
CopyAs( ( SCLP23( Application_instance_ptr ) ) &e );
CopyAs( ( SDAI_Application_instance_ptr ) &e );
}
SdaiShape::~SdaiShape() { }
SdaiShape::SdaiShape( SCLP23( Application_instance ) *se, int * addAttrs ) {
SdaiShape::SdaiShape( SDAI_Application_instance *se, int * addAttrs ) {
/* Set this to point to the head entity. */
HeadEntity( se );
@ -251,13 +251,13 @@ SdaiShape::item_color_( const SdaiColor_var x )
_item_color.put( x );
}
const SCLP23( Integer )
const SDAI_Integer
SdaiShape::number_of_sides_() const {
return ( const SCLP23( Integer ) ) _number_of_sides;
return ( const SDAI_Integer ) _number_of_sides;
}
void
SdaiShape::number_of_sides_( const SCLP23( Integer ) x )
SdaiShape::number_of_sides_( const SDAI_Integer x )
{
_number_of_sides = x;
@ -288,7 +288,7 @@ SdaiRectangle::SdaiRectangle( ) {
attributes.push( a );
}
SdaiRectangle::SdaiRectangle( SdaiRectangle & e ) {
CopyAs( ( SCLP23( Application_instance_ptr ) ) &e );
CopyAs( ( SDAI_Application_instance_ptr ) &e );
}
SdaiRectangle::~SdaiRectangle() { }
@ -311,7 +311,7 @@ SdaiRectangle_access_hook_in( void * object,
if( debug_access_hooks ) {
cout << "SdaiRectangle: non-virtual access function." << endl;
}
SCLP23( Application_instance ) *sent = ( SCLP23( Application_instance ) * )object;
SDAI_Application_instance *sent = ( SDAI_Application_instance * )object;
if( debug_access_hooks ) {
cout << "STEPfile_id: " << sent->STEPfile_id << endl;
}
@ -324,21 +324,21 @@ SdaiRectangle_access_hook_in( void * object,
ent->attributes[4].aDesc = a_5width;
}
SCLP23( Application_instance_ptr )
SDAI_Application_instance_ptr
create_SdaiRectangle( os_database * db ) {
if( db ) {
SCLP23( DAObject_ptr ) ap = new( db, SdaiRectangle::get_os_typespec() )
SDAI_DAObject_ptr ap = new( db, SdaiRectangle::get_os_typespec() )
SdaiRectangle;
return ( SCLP23( Application_instance_ptr ) ) ap;
// return (SCLP23(Application_instance_ptr)) new (db, SdaiRectangle::get_os_typespec())
return ( SDAI_Application_instance_ptr ) ap;
// return (SDAI_Application_instance_ptr)) new (db, SdaiRectangle::get_os_typespec()
// SdaiRectangle;
} else {
return ( SCLP23( Application_instance_ptr ) ) new SdaiRectangle;
return ( SDAI_Application_instance_ptr ) new SdaiRectangle;
}
}
#endif
SdaiRectangle::SdaiRectangle( SCLP23( Application_instance ) *se, int * addAttrs ) : SdaiShape( se, ( addAttrs ? &addAttrs[1] : 0 ) ) {
SdaiRectangle::SdaiRectangle( SDAI_Application_instance *se, int * addAttrs ) : SdaiShape( se, ( addAttrs ? &addAttrs[1] : 0 ) ) {
/* Set this to point to the head entity. */
HeadEntity( se );
@ -412,11 +412,11 @@ SdaiSquare::SdaiSquare( ) {
eDesc = example_schemae_square;
}
SdaiSquare::SdaiSquare( SdaiSquare & e ) {
CopyAs( ( SCLP23( Application_instance_ptr ) ) &e );
CopyAs( ( SDAI_Application_instance_ptr ) &e );
}
SdaiSquare::~SdaiSquare() { }
SdaiSquare::SdaiSquare( SCLP23( Application_instance ) *se, int * addAttrs ) : SdaiRectangle( se, ( addAttrs ? &addAttrs[1] : 0 ) ) {
SdaiSquare::SdaiSquare( SDAI_Application_instance *se, int * addAttrs ) : SdaiRectangle( se, ( addAttrs ? &addAttrs[1] : 0 ) ) {
/* Set this to point to the head entity. */
HeadEntity( se );
@ -459,11 +459,11 @@ SdaiTriangle::SdaiTriangle( ) {
attributes.push( a );
}
SdaiTriangle::SdaiTriangle( SdaiTriangle & e ) {
CopyAs( ( SCLP23( Application_instance_ptr ) ) &e );
CopyAs( ( SDAI_Application_instance_ptr ) &e );
}
SdaiTriangle::~SdaiTriangle() { }
SdaiTriangle::SdaiTriangle( SCLP23( Application_instance ) *se, int * addAttrs ) : SdaiShape( se, ( addAttrs ? &addAttrs[1] : 0 ) ) {
SdaiTriangle::SdaiTriangle( SDAI_Application_instance *se, int * addAttrs ) : SdaiShape( se, ( addAttrs ? &addAttrs[1] : 0 ) ) {
/* Set this to point to the head entity. */
HeadEntity( se );
@ -565,11 +565,11 @@ SdaiCircle::SdaiCircle( ) {
attributes.push( a );
}
SdaiCircle::SdaiCircle( SdaiCircle & e ) {
CopyAs( ( SCLP23( Application_instance_ptr ) ) &e );
CopyAs( ( SDAI_Application_instance_ptr ) &e );
}
SdaiCircle::~SdaiCircle() { }
SdaiCircle::SdaiCircle( SCLP23( Application_instance ) *se, int * addAttrs ) : SdaiShape( se, ( addAttrs ? &addAttrs[1] : 0 ) ) {
SdaiCircle::SdaiCircle( SDAI_Application_instance *se, int * addAttrs ) : SdaiShape( se, ( addAttrs ? &addAttrs[1] : 0 ) ) {
/* Set this to point to the head entity. */
HeadEntity( se );
@ -591,13 +591,13 @@ SdaiCircle::SdaiCircle( SCLP23( Application_instance ) *se, int * addAttrs ) : S
}
}
const SCLP23( Real )
const SDAI_Real
SdaiCircle::radius_() const {
return ( const SCLP23( Real ) ) _radius;
return ( const SDAI_Real ) _radius;
}
void
SdaiCircle::radius_( const SCLP23( Real ) x )
SdaiCircle::radius_( const SDAI_Real x )
{
_radius = x;
@ -619,20 +619,20 @@ SdaiLine::SdaiLine( ) {
eDesc = example_schemae_line;
STEPattribute * a = new STEPattribute( *a_10end_point_one, ( SCLP23( Application_instance_ptr ) * ) &_end_point_one );
STEPattribute * a = new STEPattribute( *a_10end_point_one, ( SDAI_Application_instance_ptr * ) &_end_point_one );
a -> set_null();
attributes.push( a );
a = new STEPattribute( *a_11end_point_two, ( SCLP23( Application_instance_ptr ) * ) &_end_point_two );
a = new STEPattribute( *a_11end_point_two, ( SDAI_Application_instance_ptr * ) &_end_point_two );
a -> set_null();
attributes.push( a );
}
SdaiLine::SdaiLine( SdaiLine & e ) {
CopyAs( ( SCLP23( Application_instance_ptr ) ) &e );
CopyAs( ( SDAI_Application_instance_ptr ) &e );
}
SdaiLine::~SdaiLine() { }
SdaiLine::SdaiLine( SCLP23( Application_instance ) *se, int * addAttrs ) {
SdaiLine::SdaiLine( SDAI_Application_instance *se, int * addAttrs ) {
/* Set this to point to the head entity. */
HeadEntity( se );
@ -640,7 +640,7 @@ SdaiLine::SdaiLine( SCLP23( Application_instance ) *se, int * addAttrs ) {
eDesc = example_schemae_line;
STEPattribute * a = new STEPattribute( *a_10end_point_one, ( SCLP23( Application_instance_ptr ) * ) &_end_point_one );
STEPattribute * a = new STEPattribute( *a_10end_point_one, ( SDAI_Application_instance_ptr * ) &_end_point_one );
a -> set_null();
/* Put attribute on this class' attributes list so the */
/*access functions still work. */
@ -651,7 +651,7 @@ SdaiLine::SdaiLine( SCLP23( Application_instance ) *se, int * addAttrs ) {
se->attributes.push( a );
}
a = new STEPattribute( *a_11end_point_two, ( SCLP23( Application_instance_ptr ) * ) &_end_point_two );
a = new STEPattribute( *a_11end_point_two, ( SDAI_Application_instance_ptr * ) &_end_point_two );
a -> set_null();
/* Put attribute on this class' attributes list so the */
/*access functions still work. */
@ -715,11 +715,11 @@ SdaiCartesian_point::SdaiCartesian_point( ) {
attributes.push( a );
}
SdaiCartesian_point::SdaiCartesian_point( SdaiCartesian_point & e ) {
CopyAs( ( SCLP23( Application_instance_ptr ) ) &e );
CopyAs( ( SDAI_Application_instance_ptr ) &e );
}
SdaiCartesian_point::~SdaiCartesian_point() { }
SdaiCartesian_point::SdaiCartesian_point( SCLP23( Application_instance ) *se, int * addAttrs ) {
SdaiCartesian_point::SdaiCartesian_point( SDAI_Application_instance *se, int * addAttrs ) {
/* Set this to point to the head entity. */
HeadEntity( se );
@ -800,42 +800,42 @@ SdaiCartesian_point::z_( const SdaiPoint x )
///////// END_ENTITY cartesian_point
SCLP23( Model_contents_ptr ) create_SdaiModel_contents_example_schema() {
SDAI_Model_contents_ptr create_SdaiModel_contents_example_schema() {
return new SdaiModel_contents_example_schema ;
}
SdaiModel_contents_example_schema::SdaiModel_contents_example_schema() {
SCLP23( Entity_extent_ptr ) eep = ( SCLP23( Entity_extent_ptr ) )0;
SDAI_Entity_extent_ptr eep = ( SDAI_Entity_extent_ptr )0;
eep = new SCLP23( Entity_extent );
eep = new SDAI_Entity_extent ;
eep->definition_( example_schemae_poly_line );
_folders.Append( eep );
eep = new SCLP23( Entity_extent );
eep = new SDAI_Entity_extent ;
eep->definition_( example_schemae_shape );
_folders.Append( eep );
eep = new SCLP23( Entity_extent );
eep = new SDAI_Entity_extent ;
eep->definition_( example_schemae_rectangle );
_folders.Append( eep );
eep = new SCLP23( Entity_extent );
eep = new SDAI_Entity_extent ;
eep->definition_( example_schemae_square );
_folders.Append( eep );
eep = new SCLP23( Entity_extent );
eep = new SDAI_Entity_extent ;
eep->definition_( example_schemae_triangle );
_folders.Append( eep );
eep = new SCLP23( Entity_extent );
eep = new SDAI_Entity_extent ;
eep->definition_( example_schemae_circle );
_folders.Append( eep );
eep = new SCLP23( Entity_extent );
eep = new SDAI_Entity_extent ;
eep->definition_( example_schemae_line );
_folders.Append( eep );
eep = new SCLP23( Entity_extent );
eep = new SDAI_Entity_extent ;
eep->definition_( example_schemae_cartesian_point );
_folders.Append( eep );

View file

@ -24,7 +24,7 @@ enum Color {
Color_unset
};
class SdaiColor_var : public SCLP23( Enum ) {
class SdaiColor_var : public SDAI_Enum {
protected:
EnumTypeDescriptor * type;
@ -54,7 +54,7 @@ class SdaiColor_var : public SCLP23( Enum ) {
typedef SdaiColor_var * SdaiColor_var_ptr;
SCLP23( Enum ) * create_SdaiColor_var();
SDAI_Enum * create_SdaiColor_var();
class SdaiColor_vars : public EnumAggregate {
@ -87,7 +87,7 @@ STEPaggregate * create_SdaiColor_vars();
extern AttrDescriptor * a_0points;
class SdaiPoly_line : public SCLP23( Application_instance ) {
class SdaiPoly_line : public SDAI_Application_instance {
protected:
EntityAggregate _points ; // of line
@ -95,7 +95,7 @@ class SdaiPoly_line : public SCLP23( Application_instance ) {
public:
SdaiPoly_line( );
SdaiPoly_line( SCLP23( Application_instance ) *se, int * addAttrs = 0 );
SdaiPoly_line( SDAI_Application_instance *se, int * addAttrs = 0 );
SdaiPoly_line( SdaiPoly_line & e );
~SdaiPoly_line();
@ -122,16 +122,16 @@ extern AttrDescriptor * a_1item_name;
extern AttrDescriptor * a_2item_color;
extern AttrDescriptor * a_3number_of_sides;
class SdaiShape : public SCLP23( Application_instance ) {
class SdaiShape : public SDAI_Application_instance {
protected:
SCLP23( String ) _item_name ;
SDAI_String _item_name ;
SdaiColor_var _item_color ; // OPTIONAL
SCLP23( Integer ) _number_of_sides ;
SDAI_Integer _number_of_sides ;
public:
SdaiShape( );
SdaiShape( SCLP23( Application_instance ) *se, int * addAttrs = 0 );
SdaiShape( SDAI_Application_instance *se, int * addAttrs = 0 );
SdaiShape( SdaiShape & e );
~SdaiShape();
@ -144,8 +144,8 @@ class SdaiShape : public SCLP23( Application_instance ) {
const SdaiColor_var item_color_() const;
void item_color_( const SdaiColor_var x );
const SCLP23( Integer ) number_of_sides_() const;
void number_of_sides_( const SCLP23( Integer ) x );
const SDAI_Integer number_of_sides_() const;
void number_of_sides_( const SDAI_Integer x );
};
@ -166,12 +166,12 @@ extern AttrDescriptor * a_5width;
class SdaiRectangle : public SdaiShape {
protected:
SCLP23( Real ) _height ;
SCLP23( Real ) _width ;
SDAI_Real _height ;
SDAI_Real _width ;
public:
SdaiRectangle( );
SdaiRectangle( SCLP23( Application_instance ) *se, int * addAttrs = 0 );
SdaiRectangle( SDAI_Application_instance *se, int * addAttrs = 0 );
SdaiRectangle( SdaiRectangle & e );
~SdaiRectangle();
@ -206,7 +206,7 @@ class SdaiSquare : public SdaiRectangle {
public:
SdaiSquare( );
SdaiSquare( SCLP23( Application_instance ) *se, int * addAttrs = 0 );
SdaiSquare( SDAI_Application_instance *se, int * addAttrs = 0 );
SdaiSquare( SdaiSquare & e );
~SdaiSquare();
@ -235,13 +235,13 @@ extern AttrDescriptor * a_8side3_length;
class SdaiTriangle : public SdaiShape {
protected:
SCLP23( Real ) _side1_length ;
SCLP23( Real ) _side2_length ;
SCLP23( Real ) _side3_length ;
SDAI_Real _side1_length ;
SDAI_Real _side2_length ;
SDAI_Real _side3_length ;
public:
SdaiTriangle( );
SdaiTriangle( SCLP23( Application_instance ) *se, int * addAttrs = 0 );
SdaiTriangle( SDAI_Application_instance *se, int * addAttrs = 0 );
SdaiTriangle( SdaiTriangle & e );
~SdaiTriangle();
@ -277,19 +277,19 @@ extern AttrDescriptor * a_9radius;
class SdaiCircle : public SdaiShape {
protected:
SCLP23( Real ) _radius ;
SDAI_Real _radius ;
public:
SdaiCircle( );
SdaiCircle( SCLP23( Application_instance ) *se, int * addAttrs = 0 );
SdaiCircle( SDAI_Application_instance *se, int * addAttrs = 0 );
SdaiCircle( SdaiCircle & e );
~SdaiCircle();
int opcode() {
return 5 ;
}
const SCLP23( Real ) radius_() const;
void radius_( const SCLP23( Real ) x );
const SDAI_Real radius_() const;
void radius_( const SDAI_Real x );
/* The first parent's access functions are */
/* above or covered by inherited functions. */
@ -309,15 +309,15 @@ create_SdaiCircle() {
extern AttrDescriptor * a_10end_point_one;
extern AttrDescriptor * a_11end_point_two;
class SdaiLine : public SCLP23( Application_instance ) {
class SdaiLine : public SDAI_Application_instance {
protected:
SCLP23( Application_instance_ptr ) _end_point_one ;
SCLP23( Application_instance_ptr ) _end_point_two ;
SDAI_Application_instance_ptr _end_point_one ;
SDAI_Application_instance_ptr _end_point_two ;
public:
SdaiLine( );
SdaiLine( SCLP23( Application_instance ) *se, int * addAttrs = 0 );
SdaiLine( SDAI_Application_instance *se, int * addAttrs = 0 );
SdaiLine( SdaiLine & e );
~SdaiLine();
@ -347,16 +347,16 @@ extern AttrDescriptor * a_12x;
extern AttrDescriptor * a_13y;
extern AttrDescriptor * a_14z;
class SdaiCartesian_point : public SCLP23( Application_instance ) {
class SdaiCartesian_point : public SDAI_Application_instance {
protected:
SCLP23( Real ) _x ;
SCLP23( Real ) _y ;
SCLP23( Real ) _z ; // OPTIONAL
SDAI_Real _x ;
SDAI_Real _y ;
SDAI_Real _z ; // OPTIONAL
public:
SdaiCartesian_point( );
SdaiCartesian_point( SCLP23( Application_instance ) *se, int * addAttrs = 0 );
SdaiCartesian_point( SDAI_Application_instance *se, int * addAttrs = 0 );
SdaiCartesian_point( SdaiCartesian_point & e );
~SdaiCartesian_point();
@ -385,7 +385,7 @@ create_SdaiCartesian_point() {
// ***** generate Model related pieces
class SdaiModel_contents_example_schema : public SCLP23( Model_contents ) {
class SdaiModel_contents_example_schema : public SDAI_Model_contents {
public:
@ -413,6 +413,6 @@ class SdaiModel_contents_example_schema : public SCLP23( Model_contents ) {
typedef SdaiModel_contents_example_schema * SdaiModel_contents_example_schema_ptr;
typedef SdaiModel_contents_example_schema_ptr SdaiModel_contents_example_schema_var;
SCLP23( Model_contents_ptr ) create_SdaiModel_contents_example_schema();
SDAI_Model_contents_ptr create_SdaiModel_contents_example_schema();
#endif

View file

@ -12,11 +12,11 @@ extern Schema * s_example_schema;
// Types:
class SdaiColor_vars;
extern EnumTypeDescriptor * example_schemat_color;
typedef SCLP23( String ) SdaiLabel;
typedef SDAI_String SdaiLabel;
extern TypeDescriptor * example_schemat_label;
typedef SCLP23( Real ) SdaiPoint;
typedef SDAI_Real SdaiPoint;
extern TypeDescriptor * example_schemat_point;
typedef SCLP23( Real ) SdaiLength_measure;
typedef SDAI_Real SdaiLength_measure;
extern TypeDescriptor * example_schemat_length_measure;
// Entities:
@ -24,64 +24,64 @@ class SdaiPoly_line;
typedef SdaiPoly_line * SdaiPoly_lineH;
typedef SdaiPoly_line * SdaiPoly_line_ptr;
typedef SdaiPoly_line_ptr SdaiPoly_line_var;
#define SdaiPoly_line__set SCLP23(DAObject__set)
#define SdaiPoly_line__set_var SCLP23(DAObject__set_var)
#define SdaiPoly_line__set SDAI_DAObject__set
#define SdaiPoly_line__set_var SDAI_DAObject__set_var
extern EntityDescriptor * example_schemae_poly_line;
class SdaiShape;
typedef SdaiShape * SdaiShapeH;
typedef SdaiShape * SdaiShape_ptr;
typedef SdaiShape_ptr SdaiShape_var;
#define SdaiShape__set SCLP23(DAObject__set)
#define SdaiShape__set_var SCLP23(DAObject__set_var)
#define SdaiShape__set SDAI_DAObject__set
#define SdaiShape__set_var SDAI_DAObject__set_var
extern EntityDescriptor * example_schemae_shape;
class SdaiRectangle;
typedef SdaiRectangle * SdaiRectangleH;
typedef SdaiRectangle * SdaiRectangle_ptr;
typedef SdaiRectangle_ptr SdaiRectangle_var;
#define SdaiRectangle__set SCLP23(DAObject__set)
#define SdaiRectangle__set_var SCLP23(DAObject__set_var)
#define SdaiRectangle__set SDAI_DAObject__set
#define SdaiRectangle__set_var SDAI_DAObject__set_var
extern EntityDescriptor * example_schemae_rectangle;
class SdaiSquare;
typedef SdaiSquare * SdaiSquareH;
typedef SdaiSquare * SdaiSquare_ptr;
typedef SdaiSquare_ptr SdaiSquare_var;
#define SdaiSquare__set SCLP23(DAObject__set)
#define SdaiSquare__set_var SCLP23(DAObject__set_var)
#define SdaiSquare__set SDAI_DAObject__set
#define SdaiSquare__set_var SDAI_DAObject__set_var
extern EntityDescriptor * example_schemae_square;
class SdaiTriangle;
typedef SdaiTriangle * SdaiTriangleH;
typedef SdaiTriangle * SdaiTriangle_ptr;
typedef SdaiTriangle_ptr SdaiTriangle_var;
#define SdaiTriangle__set SCLP23(DAObject__set)
#define SdaiTriangle__set_var SCLP23(DAObject__set_var)
#define SdaiTriangle__set SDAI_DAObject__set
#define SdaiTriangle__set_var SDAI_DAObject__set_var
extern EntityDescriptor * example_schemae_triangle;
class SdaiCircle;
typedef SdaiCircle * SdaiCircleH;
typedef SdaiCircle * SdaiCircle_ptr;
typedef SdaiCircle_ptr SdaiCircle_var;
#define SdaiCircle__set SCLP23(DAObject__set)
#define SdaiCircle__set_var SCLP23(DAObject__set_var)
#define SdaiCircle__set SDAI_DAObject__set
#define SdaiCircle__set_var SDAI_DAObject__set_var
extern EntityDescriptor * example_schemae_circle;
class SdaiLine;
typedef SdaiLine * SdaiLineH;
typedef SdaiLine * SdaiLine_ptr;
typedef SdaiLine_ptr SdaiLine_var;
#define SdaiLine__set SCLP23(DAObject__set)
#define SdaiLine__set_var SCLP23(DAObject__set_var)
#define SdaiLine__set SDAI_DAObject__set
#define SdaiLine__set_var SDAI_DAObject__set_var
extern EntityDescriptor * example_schemae_line;
class SdaiCartesian_point;
typedef SdaiCartesian_point * SdaiCartesian_pointH;
typedef SdaiCartesian_point * SdaiCartesian_point_ptr;
typedef SdaiCartesian_point_ptr SdaiCartesian_point_var;
#define SdaiCartesian_point__set SCLP23(DAObject__set)
#define SdaiCartesian_point__set_var SCLP23(DAObject__set_var)
#define SdaiCartesian_point__set SDAI_DAObject__set
#define SdaiCartesian_point__set_var SDAI_DAObject__set_var
extern EntityDescriptor * example_schemae_cartesian_point;
#endif

View file

@ -21,9 +21,9 @@ SchemaInit( Registry & reg ) {
// dictionary (Registry) handle since it doesn't have a
// predetermined way to access to the handle.
SCLP23( Model_contents_ptr ) GetModelContents( char * schemaName ) {
SDAI_Model_contents_ptr GetModelContents( char * schemaName ) {
if( !strcmp( schemaName, "example_schema" ) ) {
return ( SCLP23( Model_contents_ptr ) ) new SdaiModel_contents_example_schema;
return ( SDAI_Model_contents_ptr ) new SdaiModel_contents_example_schema;
}
}
#endif

View file

@ -30,5 +30,5 @@ extern void SdaiEXAMPLE_SCHEMAInit( Registry & r );
#include <complexSupport.h>
ComplexCollect * gencomplex();
SCLP23( Model_contents_ptr ) GetModelContents( char * schemaName );
SDAI_Model_contents_ptr GetModelContents( char * schemaName );
#endif

View file

@ -1,31 +1,31 @@
set(LIBSTEPDAI_SRCS
sdaiApplication_instance_set.cc
sdaiSession_instance.cc
sdaiObject.cc
sdaiDaObject.cc
sdaiEntity_extent.cc
sdaiEntity_extent_set.cc
sdaiModel_contents.cc
sdaiModel_contents_list.cc
sdaiEnum.cc
sdaiString.cc
sdaiApplication_instance_set.cc
sdaiBinary.cc
sdaiDaObject.cc
sdaiEntity_extent.cc
sdaiEntity_extent_set.cc
sdaiEnum.cc
sdaiModel_contents.cc
sdaiModel_contents_list.cc
sdaiObject.cc
sdaiSession_instance.cc
sdaiString.cc
)
SET(LIBSTEPDAI_PRIVATE_HDRS
sdaiApplication_instance_set.h
sdaiDaObject.h
sdaiEntity_extent.h
sdaiEntity_extent_set.h
sdaiModel_contents.h
sdaiModel_contents_list.h
sdaiObject.h
sdaiSession_instance.h
StrUtil.hh
sdaiEnum.h
sdaiString.h
sdaiApplication_instance_set.h
sdaiBinary.h
sdaiDaObject.h
sdaiEntity_extent.h
sdaiEntity_extent_set.h
sdaiEnum.h
sdaiModel_contents.h
sdaiModel_contents_list.h
sdaiObject.h
sdaiSession_instance.h
sdaiString.h
StrUtil.hh
)
include_directories(
@ -35,4 +35,4 @@ include_directories(
${SCL_SOURCE_DIR}/src/clutils
)
SCL_ADDLIB(stepdai "${LIBSTEPDAI_SRCS}" "steputils base")
SCL_ADDLIB(stepdai "${LIBSTEPDAI_SRCS}" "steputils;base")

View file

@ -1,7 +1,6 @@
#ifndef SDAIBINARY_H
#define SDAIBINARY_H 1
#include <scl_export.h>
#include <string>
/*

View file

@ -39,8 +39,8 @@ class SCL_DAI_EXPORT SDAI_PID : public SDAI_sdaiObject {
// static PID_ptr _narrow(SDAI_sdaiObject_ptr);
// static PID_ptr _nil();
SDAI_String _datastore_type ;
SDAI_String _pidstring ;
SDAI_String _datastore_type;
SDAI_String _pidstring;
// constructor/destructor
SDAI_PID();
@ -50,7 +50,7 @@ class SCL_DAI_EXPORT SDAI_PID : public SDAI_sdaiObject {
The Datestore_type attribute shall identify the type of the underlying
datastore.
*/
char * Datastore_type() const {
char * Datastore_type() const {
return const_cast<char *>( _datastore_type.c_str() );
}
void Datastore_type( char * x ) {
@ -92,7 +92,7 @@ typedef SDAI_PID_ptr SDAI_PID_var;
class SCL_DAI_EXPORT SDAI_PID_DA: public SDAI_PID {
public:
SDAI_String _oid ;
SDAI_String _oid;
// oid (ISO/DIS 10303-23:1996(E) 5.3.10.3)
//
// This attribute shall set and return the string representation of the
@ -127,7 +127,7 @@ typedef SDAI_PID_DA_ptr SDAI_PID_DA_var;
//
class SCL_DAI_EXPORT SDAI_PID_SDAI : public SDAI_PID {
public:
SDAI_String _modelid ;
SDAI_String _modelid;
// constructor/destructor
SDAI_PID_SDAI();
@ -142,7 +142,7 @@ class SCL_DAI_EXPORT SDAI_PID_SDAI : public SDAI_PID {
virtual void Modelid( const char * x ) {
_modelid = x;
}
virtual char * Modelid() const {
virtual char * Modelid() const {
return const_cast<char *>( _modelid.c_str() );
}
};
@ -442,8 +442,8 @@ class SCL_DAI_EXPORT SDAI_DAObject_SDAI : public SDAI_DAObject {
*/
#ifdef SDAI_CPP_LATE_BINDING
Boolean TestAttr( const Attribute_ptr & attDef );
Boolean TestAttr( const char * attName ) const;
::Boolean TestAttr( const Attribute_ptr & attDef );
::Boolean TestAttr( const char * attName ) const;
#endif
/*

View file

@ -27,8 +27,8 @@ SDAI_Entity_extent::~SDAI_Entity_extent() {
delete _definition_name;
}
const Entity_ptr
SDAI_Entity_extent::definition_() const {
Entity_ptr
SDAI_Entity_extent ::definition_() const {
return _definition;
}
@ -56,9 +56,9 @@ SDAI_Entity_extent::owned_by_( SDAI_Model_contents__list_var & mclv ) {
// _owned_by = mcp;
}
const SDAI_Model_contents__list_var
SDAI_Entity_extent::owned_by_() const {
return ( const SDAI_Model_contents__list_var ) &_owned_by;
SDAI_Model_contents__list_var
SDAI_Entity_extent ::owned_by_() const {
return ( const SDAI_Model_contents__list_var ) &_owned_by;
}
/*

View file

@ -47,7 +47,7 @@ class SCL_DAI_EXPORT SDAI_Entity_extent : public SDAI_Session_instance {
return _definition_name;
}
const Entity_ptr definition_() const;
Entity_ptr definition_() const;
#ifdef SDAI_CPP_LATE_BINDING
// const Entity_ptr definition_() const;
#endif
@ -60,7 +60,7 @@ class SCL_DAI_EXPORT SDAI_Entity_extent : public SDAI_Session_instance {
}
// need to implement Model_contents__list
const SDAI_Model_contents__list_var owned_by_() const;
SDAI_Model_contents__list_var owned_by_() const;
// static SDAI_Entity_extent_ptr
// _duplicate(SDAI_Entity_extent_ptr eep);

View file

@ -27,6 +27,8 @@
* UArray - dynamic array object.
*/
#include <scl_export.h>
#ifndef SDAIENTITY_EXTENT_SET_h
#define SDAIENTITY_EXTENT_SET_h

View file

@ -4,7 +4,7 @@
/*
* NIST STEP Core Class Library
* clstepcore/sdaiEnum.cc
* cldai/sdaiEnum.cc
* April 1997
* K. C. Morris
* David Sauder
@ -19,7 +19,7 @@
// class Logical
///////////////////////////////////////////////////////////////////////////////
SDAI_LOGICAL::SDAI_LOGICAL( char * val ) {
SDAI_LOGICAL::SDAI_LOGICAL ( const char * val ) {
set_value( val );
}
@ -85,8 +85,6 @@ SDAI_LOGICAL::operator Logical() const {
}
}
SDAI_LOGICAL & SDAI_LOGICAL::operator= ( const SDAI_LOGICAL & t ) {
set_value( t.asInt() );
return *this;
@ -136,7 +134,6 @@ int SDAI_LOGICAL::set_value( const char * n ) {
return v;
}
Severity SDAI_LOGICAL::ReadEnum( istream & in, ErrorDescriptor * err, int AssignVal,
int needDelims ) {
if( AssignVal ) {
@ -645,8 +642,6 @@ Severity SDAI_Enum::EnumValidLevel( const char * value, ErrorDescriptor * err,
** \returns: value set
******************************************************************/
int SDAI_Enum::set_value( const char * n ) {
// assigns the appropriate value based on n
// if ( !n || (!strcmp (n, "")) ) return set_value (ENUM_NULL);
if( !n || ( !strcmp( n, "" ) ) ) {
nullify();
return asInt();
@ -683,7 +678,6 @@ int SDAI_Enum::set_value( const int i ) {
<< " for " << Name() << "\n";
DebugDisplay();
return no_elements() + 1 ;
}
SDAI_Enum & SDAI_Enum::operator= ( const int i ) {

View file

@ -1,5 +1,5 @@
#ifndef P23ENUM_H
#define P23ENUM_H
#define P23ENUM_H
/*
* NIST STEP Core Class Library
@ -14,7 +14,7 @@
#include <scl_export.h>
class SCL_DAI_EXPORT SDAI_Enum {
class SCL_DAI_EXPORT SDAI_Enum {
friend ostream & operator<< ( ostream &, const SDAI_Enum & );
protected:
int v; // integer value of enumeration instance
@ -46,7 +46,7 @@ class SCL_DAI_EXPORT SDAI_Enum {
int optional, char * tokenList,
int needDelims = 0, int clearError = 1 );
const int asInt() const {
int asInt() const {
return v;
}
@ -86,12 +86,12 @@ class SDAI_BOOLEAN;
enum Boolean { BFalse, BTrue, BUnset };
enum Logical { LFalse, LTrue, LUnset, LUnknown };
class SCL_DAI_EXPORT SDAI_LOGICAL :
class SCL_DAI_EXPORT SDAI_LOGICAL :
public SDAI_Enum {
public:
const char * Name() const;
SDAI_LOGICAL( char * val = 0 );
SDAI_LOGICAL( const char * val = 0 );
SDAI_LOGICAL( Logical state );
SDAI_LOGICAL( const SDAI_LOGICAL & source );
SDAI_LOGICAL( int i );
@ -118,7 +118,7 @@ class SCL_DAI_EXPORT SDAI_LOGICAL :
};
class SCL_DAI_EXPORT SDAI_BOOLEAN :
class SCL_DAI_EXPORT SDAI_BOOLEAN :
public SDAI_Enum {
public:
const char * Name() const;

View file

@ -4,31 +4,18 @@
///////// SDAI_Model_contents_instances
SDAI_Model_contents_instances::SDAI_Model_contents_instances( ) {
SDAI_Model_contents_instances::SDAI_Model_contents_instances ( ) {
}
/*
SDAI_Model_contents_instances::SDAI_Model_contents_instances (const SDAI_Model_contents_instances& e )
{
}
*/
SDAI_Model_contents_instances::~SDAI_Model_contents_instances() {
SDAI_Model_contents_instances ::~SDAI_Model_contents_instances () {
}
///////// SDAI_Model_contents
SDAI_Model_contents::SDAI_Model_contents( ) {
SDAI_Model_contents::SDAI_Model_contents ( ) {
}
/*
SDAI_Model_contents::SDAI_Model_contents (const SDAI_Model_contents& e )
{
// CopyAs((STEPentityH) &e);
}
*/
SDAI_Model_contents::~SDAI_Model_contents() {
SDAI_Model_contents ::~SDAI_Model_contents() {
}
// const Entity_instance__set_var instances() const;
@ -38,9 +25,9 @@ SDAI_Model_contents::instances_() {
return &_instances;
}
const SDAI_Model_contents_instances_ptr
SDAI_Model_contents_instances_ptr
SDAI_Model_contents::instances_() const {
return ( const SDAI_Model_contents_instances_ptr ) &_instances;
return ( const SDAI_Model_contents_instances_ptr ) &_instances;
}
SDAI_Entity_extent__set_var
@ -48,7 +35,7 @@ SDAI_Model_contents::folders_() {
return &_folders;
}
const SDAI_Entity_extent__set_var
SDAI_Entity_extent__set_var
SDAI_Model_contents::folders_() const {
return ( const SDAI_Entity_extent__set_var )&_folders;
}
@ -58,7 +45,7 @@ SDAI_Model_contents::populated_folders_() {
return &_populated_folders;
}
const SDAI_Entity_extent__set_var
SDAI_Entity_extent__set_var
SDAI_Model_contents::populated_folders_() const {
return ( const SDAI_Entity_extent__set_var )&_populated_folders;
}

View file

@ -39,7 +39,7 @@ class SCL_DAI_EXPORT SDAI_Model_contents_instances : public SDAI_DAObject {
SDAI_DAObject__set_var contents_() {
return &_instances;
}
const SDAI_DAObject__set_var contents_() const {
SDAI_DAObject__set_var contents_() const {
return ( const SDAI_DAObject__set_var ) &_instances;
};
@ -51,8 +51,6 @@ typedef SDAI_Model_contents_instances_ptr
SDAI_Model_contents_instances_var;
// Model_contents_ptr def pushed ahead of #include for Entity_extent
//class SDAI_Model_contents;
//typedef SDAI_Model_contents SDAI_Model_contents_ptr;
class SCL_DAI_EXPORT SDAI_Model_contents : public SDAI_Session_instance {
@ -65,46 +63,30 @@ class SCL_DAI_EXPORT SDAI_Model_contents : public SDAI_Session_instance {
DATA MEMBERS
*/
public:
// protected: // for now
// contains Application_instances (i.e. STEPentities)
SDAI_Model_contents_instances _instances;
SDAI_Entity_extent__set _folders; // of entity_extent
SDAI_Entity_extent__set _folders; // of entity_extent
SDAI_Entity_extent__set _populated_folders; // of entity_extent
// EntityAggregate _instances; // of Entity_instance
// EntityAggregate _folders; // of entity_extent
// EntityAggregate _populated_folders; // of entity_extent
SDAI_Entity_extent__set _populated_folders; // of entity_extent
/*
Constructor declarations
*/
public: // for now at least
// private:
SDAI_Model_contents();
// SDAI_Model_contents(const SDAI_Model_contents& mc);
~SDAI_Model_contents();
SDAI_Model_contents ();
~SDAI_Model_contents ();
/*
Access function declarations
*/
public:
SDAI_Model_contents_instances_ptr instances_();
const SDAI_Model_contents_instances_ptr instances_() const;
SDAI_Model_contents_instances_ptr instances_() const;
SDAI_Entity_extent__set_var folders_();
const SDAI_Entity_extent__set_var folders_() const;
SDAI_Entity_extent__set_var folders_() const;
//Boolean TestFolders() const;
const SDAI_Entity_extent__set_var populated_folders_() const;
SDAI_Entity_extent__set_var populated_folders_() const;
SDAI_Entity_extent__set_var populated_folders_();
//Boolean TestPopulated_folders() const;
// static SDAI_Model_contents_ptr
// _duplicate(SDAI_Model_contents_ptr);
// static SDAI_Model_contents_ptr _narrow(Object_ptr);
// static SDAI_Model_contents_ptr _nil();
SDAI_PID_DA_ptr
get_object_pid( const SDAI_DAObject_ptr & d ) const;
@ -211,10 +193,6 @@ class SCL_DAI_EXPORT SDAI_Model_contents : public SDAI_Session_instance {
#endif
// void instances (SDAI_Model_contents_instances_ptr x);
// void folders (Entity_extent__set x);
// void populated_folders (Entity_extent__set x);
};
#endif

View file

@ -12,14 +12,6 @@ class SCL_DAI_EXPORT SDAI_Session_instance : public SDAI_sdaiObject {
SDAI_Session_instance();
virtual ~SDAI_Session_instance();
// SDAI_Session_instance(const SDAI_Session_instance& si) {}
// static SDAI_Session_instance_ptr
// _duplicate(SDAI_Session_instance_ptr sip);
// static SDAI_Session_instance_ptr
// _narrow(SDAI_Object_ptr o);
// static SDAI_Session_instance_ptr _nil();
};
typedef SDAI_Session_instance * SDAI_Session_instance_ptr;

View file

@ -13,16 +13,25 @@
#include <sstream>
#include "scl_memmgr.h"
SDAI_String::SDAI_String( const char * str, int max ) {
content = std::string( str, max );
SDAI_String::SDAI_String( const char * str, size_t max )
{
if (!str)
str = "";
if (max == std::string::npos)
content = std::string(str);
else
content = std::string(str, max);
}
SDAI_String::SDAI_String( const std::string & s ) {
content = std::string( s );
SDAI_String::SDAI_String( const std::string & s )
: content(std::string( s ))
{
}
SDAI_String::SDAI_String( const SDAI_String & s ) {
content = std::string( s.c_str() );
SDAI_String::SDAI_String( const SDAI_String & s )
: content(std::string(s.c_str()))
{
}
SDAI_String::~SDAI_String( void ) {
@ -78,23 +87,20 @@ Severity SDAI_String::STEPread( istream & in, ErrorDescriptor * err ) {
in.unsetf( ios::skipws );
// extract the string from the inputstream
string s = ToExpressStr( in, err );
std::string s = GetLiteralStr( in, err );
content += s;
// retrieve current severity
Severity sev = err -> severity();
// Not missing closing quote on string value
if( sev != SEVERITY_INPUT_ERROR && s.compare( "" ) != 0 ) {
sev = SEVERITY_NULL;
}
// There was no quote
if( !( sev == SEVERITY_INPUT_ERROR || sev == SEVERITY_NULL ) ) {
if ( s.empty() ) {
// no string was read
in.flags( flags ); // set the format state back to previous settings
clear();
err -> GreaterSeverity( SEVERITY_INCOMPLETE );
sev = SEVERITY_INCOMPLETE;
} else if ( sev != SEVERITY_INPUT_ERROR ) {
// read valid string
sev = SEVERITY_NULL;
}
return sev;
}

View file

@ -11,9 +11,9 @@
* and is not subject to copyright.
*/
#include <string>
#include <errordesc.h>
#include <scl_export.h>
#include <limits>
class SCL_DAI_EXPORT SDAI_String {
private:
@ -21,7 +21,7 @@ class SCL_DAI_EXPORT SDAI_String {
public:
//constructor(s) & destructor
SDAI_String( const char * str = 0, int max = 0 );
SDAI_String( const char * str = "", size_t max = std::string::npos);
SDAI_String( const std::string & s );
SDAI_String( const SDAI_String & s );
~SDAI_String( void );
@ -35,14 +35,16 @@ class SCL_DAI_EXPORT SDAI_String {
const char * c_str( void ) const;
// format for STEP
const char * asStr( std::string & s ) const {
s = c_str();
return s.c_str();
}
void STEPwrite( std::ostream & out = cout ) const;
void STEPwrite( ostream & out = cout ) const;
void STEPwrite( std::string & s ) const;
Severity StrToVal( const char * s );
Severity STEPread( istream & in, ErrorDescriptor * err );
Severity STEPread( const char * s, ErrorDescriptor * err );
};
#endif

View file

@ -1,15 +1,8 @@
set(LIBSTEPEDITOR_SRCS
STEPfile.cc
STEPfile.inline.cc
cmdmgr.cc
dispnode.cc
dispnodelist.cc
instmgr.cc
mgrnode.cc
mgrnodearray.cc
mgrnodelist.cc
needFunc.cc
STEPfile.cc
STEPfile.inline.cc
cmdmgr.cc
SdaiHeaderSchema.cc
SdaiHeaderSchemaAll.cc
SdaiHeaderSchemaInit.cc
@ -17,16 +10,9 @@ set(LIBSTEPEDITOR_SRCS
)
SET(LIBSTEPEDITOR_PRIVATE_HDRS
STEPfile.h
cmdmgr.h
dispnode.h
dispnodelist.h
editordefines.h
instmgr.h
mgrnode.h
mgrnodearray.h
mgrnodelist.h
needFunc.h
STEPfile.h
cmdmgr.h
editordefines.h
SdaiHeaderSchema.h
SdaiHeaderSchemaClasses.h
SdaiSchemaInit.h
@ -41,4 +27,4 @@ include_directories(
${SCL_SOURCE_DIR}/src/clutils
)
SCL_ADDLIB(stepeditor "${LIBSTEPEDITOR_SRCS}" "stepcore stepdai steputils base")
SCL_ADDLIB(stepeditor "${LIBSTEPEDITOR_SRCS}" "stepcore;stepdai;steputils;base")

View file

@ -20,34 +20,11 @@ ReplicateLinkNode and ReplicateList (specializations of the single
linked list data structure) are defined to support the implementation
of CmdMgr.
dispnode.cc, dispnode.h
Defines DisplayNode, a class encapsulating all display information for
an entity.
dispnodelist.cc, dispnodelist.h
Implements list operations for DisplayNode objects.
editordefines.h
Defines two enumeration types, displayStateEnum and stateEnum, and
defines a collection of constants used by STEPfile objects for reading
and writing files containing state information from the editing session.
instmgr.cc, instmgr.h
Defines InstMgr, a class that keeps a master list of instances in the
current editing session.
mgrnode.cc, mgrnode.h
Defines the class MgrNode, used to represent a STEPentity along with
its state information and its display information. By associating a
STEPentity with a DisplayNode, this class hides the implementation of
an application's user interface from the application model.
mgrnodearray.cc, mgrnodearray.h
Implements array operations for MgrNode objects.
mgrnodelist.cc, mgrnodelist.h
Implements list operations for MgrNode objects.
s_HEADER_SCHEMA.cc, s_HEADER_SCHEMA.h, s_HEADER_SCHEMA.init.cc
These files are generated by fedex_plus using the header schema from
Part 21. The header schema specifies the information in the header

View file

@ -22,6 +22,7 @@
#include <iostream>
#include <iterator>
#include <algorithm>
#include <vector>
#include <STEPfile.h>
#include <sdai.h>
@ -45,7 +46,7 @@
*
* side effects: STEPfile::_fileName value may change.
*/
const std::string STEPfile::SetFileName( const std::string newName ) {
std::string STEPfile::SetFileName( const std::string newName ) {
// if a newName is not given or is the same as the old, use the old name
if( ( newName.empty() ) || ( newName == _fileName ) ) {
return FileName();
@ -201,7 +202,7 @@ Severity STEPfile::ReadHeader( istream & in ) {
objsev = AppendEntityErrorMsg( &( obj->Error() ) );
//set file_id to reflect the appropriate Header Section Entity
fileid = HeaderId( keywd );
fileid = HeaderId( const_cast<char *>( keywd.c_str() ) );
//read the values from the istream
objsev = obj->STEPread( fileid, 0, ( InstMgr * )0, in, NULL, true, _strict );
@ -375,7 +376,8 @@ void STEPfile::HeaderMergeInstances( InstMgr * im ) {
//checking for _headerInstances::FILE_NAME
idnum = HeaderId( "File_Name" );
if( ( se = _headerInstances->GetApplication_instance( _headerInstances->FindFileId( idnum ) ) ) ) {
se = _headerInstances->GetApplication_instance( _headerInstances->FindFileId( idnum ) );
if( se ) {
from = im->GetApplication_instance( im->FindFileId( idnum ) );
// name:
@ -392,7 +394,8 @@ void STEPfile::HeaderMergeInstances( InstMgr * im ) {
//checking for _headerInstances::FILE_DESCRIPTION
idnum = HeaderId( "File_Description" );
if( ( se = _headerInstances->GetApplication_instance( _headerInstances->FindFileId( idnum ) ) ) ) {
se = _headerInstances->GetApplication_instance( _headerInstances->FindFileId( idnum ) );
if( se ) {
from = im->GetApplication_instance( im->FindFileId( idnum ) );
//description
@ -404,7 +407,8 @@ void STEPfile::HeaderMergeInstances( InstMgr * im ) {
//checking for _headerInstances::FILE_SCHEMA
idnum = HeaderId( "File_Schema" );
if( ( se = _headerInstances->GetApplication_instance( _headerInstances->FindFileId( idnum ) ) ) ) {
se = _headerInstances->GetApplication_instance( _headerInstances->FindFileId( idnum ) );
if( se ) {
from = im->GetApplication_instance( im->FindFileId( idnum ) );
//description
@ -423,16 +427,12 @@ stateEnum STEPfile::EntityWfState( char c ) {
switch( c ) {
case wsSaveComplete:
return completeSE;
case wsSaveIncomplete:
return incompleteSE;
case wsDelete:
return deleteSE;
case wsNew:
return newSE;
default:
return noStateSE;
}
@ -553,7 +553,6 @@ int STEPfile::ReadData1( istream & in ) {
return instance_count;
}
int STEPfile::ReadWorkingData1( istream & in ) {
return ReadData1( in );
}
@ -582,8 +581,6 @@ int STEPfile::ReadData2( istream & in, bool useTechCor ) {
SDAI_Application_instance * obj = ENTITY_NULL;
std::string cmtStr;
// ReadTokenSeparator(in, &cmtStr);
int endsec = FoundEndSecKywd( in, _error );
// PASS 2: read instances
@ -597,15 +594,6 @@ int STEPfile::ReadData2( istream & in, bool useTechCor ) {
ReadTokenSeparator( in, &cmtStr );
in >> c; // read the ENTITY_NAME_DELIM
}
/*
// don't need this error msg for the 2nd pass (it was done on 1st)
else
{
cout << "Invalid editing state character: " << c << endl;
cout << "Assigning editing state to be INCOMPLETE\n";
inst_state = incompleteSE;
}
*/
}
if( c != ENTITY_NAME_DELIM ) {
@ -684,8 +672,6 @@ int STEPfile::ReadData2( istream & in, bool useTechCor ) {
_error.AppendToUserMsg( "Error in input file.\n" );
}
// if( in.good() )
// in.putback(c);
return valid_insts;
}
@ -841,7 +827,6 @@ SDAI_Application_instance * STEPfile::CreateInstance( istream & in, ostream & ou
}
//check for subtype/supertype record
//DAS todo
if( c == '(' ) {
// TODO: implement complex inheritance
@ -935,8 +920,7 @@ Severity STEPfile::CreateScopeInstances( istream & in, SDAI_Application_instance
std::string tmpbuf;
char c;
int exportid;
SDAI_Application_instance_ptr inscope [BUFSIZ];
int i = 0;
std::vector< SDAI_Application_instance_ptr > inscope;
std::string keywd;
keywd = GetKeyword( in, " \n\t/\\#;", _error );
@ -958,10 +942,8 @@ Severity STEPfile::CreateScopeInstances( istream & in, SDAI_Application_instance
if( se != ENTITY_NULL ) {
//TODO: apply scope information to se
// Add se to scopelist
if( i < BUFSIZ ) {
inscope [i] = se;
++i;
}
inscope.push_back(se);
//append the se to the instance manager
instances().Append( se, newSE );
} else {
@ -977,10 +959,9 @@ Severity STEPfile::CreateScopeInstances( istream & in, SDAI_Application_instance
in.get( c );
}
in.putback( c );
*scopelist = new SDAI_Application_instance_ptr [i];
while( i > 0 ) {
*scopelist [i - 1] = inscope [i];
i--;
*scopelist = new SDAI_Application_instance_ptr [inscope.size()];
for (size_t i = 0; i < inscope.size(); ++i) {
*scopelist[i] = inscope[i];
}
//check for "ENDSCOPE"
@ -1166,7 +1147,6 @@ Severity STEPfile::ReadScopeInstances( istream & in ) {
return rval;
}
/**
This function populates a SDAI_Application_instance with the values read from
the istream.
@ -1288,7 +1268,7 @@ SDAI_Application_instance * STEPfile::ReadInstance( istream & in, ostream & out,
if( !in.good() ) {
out << "ERROR: instance #" << fileid
<< " Unexpected file problem in "
<< "STEPfile::ReadInstance." << endl;;
<< "STEPfile::ReadInstance." << endl;
}
ReadTokenSeparator( in, &cmtStr );
@ -1337,7 +1317,7 @@ SDAI_Application_instance * STEPfile::ReadInstance( istream & in, ostream & out,
case SEVERITY_BUG:
case SEVERITY_INCOMPLETE:
if( _fileType == VERSION_CURRENT ) {
if( ( _fileType == VERSION_CURRENT ) ) {
cerr << "ERROR in EXCHANGE FILE: incomplete instance #"
<< obj -> STEPfile_id << ".\n";
if( _fileType != WORKING_SESSION ) {
@ -1408,9 +1388,6 @@ void STEPfile::MakeBackupFile() {
_error.AppendToDetailMsg( "\n" );
}
/***************************
***************************/
Severity STEPfile::WriteExchangeFile( ostream & out, int validate, int clearError,
int writeComments ) {
Severity rval = SEVERITY_NULL;
@ -1436,8 +1413,6 @@ Severity STEPfile::WriteExchangeFile( ostream & out, int validate, int clearErro
return rval;
}
/***************************
***************************/
Severity STEPfile::WriteExchangeFile( const std::string filename, int validate, int clearError,
int writeComments ) {
Severity rval = SEVERITY_NULL;
@ -1465,9 +1440,6 @@ Severity STEPfile::WriteExchangeFile( const std::string filename, int validate,
return rval;
}
/***************************
***************************/
Severity STEPfile::WriteValuePairsFile( ostream & out, int validate, int clearError,
int writeComments, int mixedCase ) {
Severity rval = SEVERITY_NULL;
@ -1504,7 +1476,7 @@ The header section entities must be numbered in the following manner:
#2=FILE_NAME
#3=FILE_SCHEMA
*/
int STEPfile::HeaderId( const std::string name ) {
int STEPfile::HeaderId( const char * name ) {
std::string tmp = name;
std::transform( tmp.begin(), tmp.end(), tmp.begin(), ::toupper );
@ -1598,27 +1570,25 @@ void STEPfile::WriteHeaderInstanceFileDescription( ostream & out ) {
SDAI_Application_instance * se = 0;
se = _headerInstances->GetApplication_instance( "File_Description" );
if( se == ENTITY_NULL ) {
// ERROR: no File_Name instance in _headerInstances
// create a File_Name instance
se = ( SDAI_Application_instance * )HeaderDefaultFileDescription();
}
WriteHeaderInstance( se, out );
}
void STEPfile::WriteHeaderInstanceFileSchema( ostream & out ) {
// Get the FileName instance from _headerInstances
SDAI_Application_instance * se = 0;
// Get the FileName instance from _headerInstances
se = _headerInstances->GetApplication_instance( "File_Schema" );
if( se == ENTITY_NULL ) {
// ERROR: no File_Name instance in _headerInstances
// create a File_Name instance
se = ( SDAI_Application_instance * ) HeaderDefaultFileSchema();
}
WriteHeaderInstance( se, out );
}
/***************************
***************************/
void STEPfile::WriteData( ostream & out, int writeComments ) {
_oFileInstsWritten = 0;
std::string currSch = schemaName();
@ -1633,9 +1603,6 @@ void STEPfile::WriteData( ostream & out, int writeComments ) {
out << "ENDSEC;\n";
}
/***************************
***************************/
void STEPfile::WriteValuePairsData( ostream & out, int writeComments, int mixedCase ) {
std::string currSch = schemaName();
int n = instances().InstanceCount();
@ -1668,9 +1635,7 @@ Severity STEPfile::AppendFile( istream * in, bool useTechCor ) {
_error.GreaterSeverity( SEVERITY_WARNING );
}
SetFileType( WORKING_SESSION );
}
else {
} else {
sprintf( errbuf,
"Faulty input at beginning of file. \"ISO-10303-21;\" or"
" \"STEP_WORKING_SESSION;\" expected. File not read: %s\n",
@ -1680,28 +1645,24 @@ Severity STEPfile::AppendFile( istream * in, bool useTechCor ) {
return SEVERITY_INPUT_ERROR;
}
if( _verbose || _errorCount || _warningCount ) {
cout << "Reading Data from " << ( ( FileName().compare( "-" ) == 0 ) ? "standard input" : FileName().c_str() ) << "...\n";
}
cout << "Reading Data from " << ( ( FileName().compare( "-" ) == 0 ) ? "standard input" : FileName().c_str() ) << "...\n";
// Read header
rval = ReadHeader( *in );
if( _verbose || _errorCount || _warningCount ) {
cout << "\nHEADER read:";
if( rval < SEVERITY_WARNING ) {
sprintf( errbuf,
"Error: non-recoverable error in reading header section. "
"There were %d errors encountered. Rest of file is ignored.\n",
_errorCount );
_error.AppendToUserMsg( errbuf );
return rval;
} else if( rval != SEVERITY_NULL ) {
sprintf( errbuf, " %d ERRORS\t %d WARNINGS\n\n",
_errorCount, _warningCount );
cout << errbuf;
} else {
cout << endl;
}
cout << "\nHEADER read:";
if( rval < SEVERITY_WARNING ) {
sprintf( errbuf,
"Error: non-recoverable error in reading header section. "
"There were %d errors encountered. Rest of file is ignored.\n",
_errorCount );
_error.AppendToUserMsg( errbuf );
return rval;
} else if( rval != SEVERITY_NULL ) {
sprintf( errbuf, " %d ERRORS\t %d WARNINGS\n\n",
_errorCount, _warningCount );
cout << errbuf;
} else {
cout << endl;
}
if( !FindDataSection( *in ) ) {
@ -1713,14 +1674,12 @@ Severity STEPfile::AppendFile( istream * in, bool useTechCor ) {
_errorCount = 0;
total_insts = ReadData1( *in );
if( _verbose || _errorCount || _warningCount ) {
cout << "\nFIRST PASS complete: " << total_insts
cout << "\nFIRST PASS complete: " << total_insts
<< " instances created.\n";
sprintf( errbuf,
" %d ERRORS\t %d WARNINGS\n\n",
_errorCount, _warningCount );
cout << errbuf;
}
sprintf( errbuf,
" %d ERRORS\t %d WARNINGS\n\n",
_errorCount, _warningCount );
cout << errbuf;
// PASS 2
// This would be nicer if you didn't actually have to close the
@ -1753,9 +1712,9 @@ Severity STEPfile::AppendFile( istream * in, bool useTechCor ) {
valid_insts = ReadData2( *in2, useTechCor );
break;
default:
cerr << "STEPfile::AppendFile: type " << _fileType << " not handled by switch statement. " << __FILE__ << ":" << __LINE__ << endl;
abort();
_error.AppendToUserMsg( "STEPfile::AppendFile: STEP file version set to unrecognized value.\n" );
CloseInputFile( in2 );
return SEVERITY_BUG;
}
//check for "ENDSEC;"
@ -1768,15 +1727,13 @@ Severity STEPfile::AppendFile( istream * in, bool useTechCor ) {
return _error.GreaterSeverity( SEVERITY_WARNING );
}
if( _verbose || _errorCount || _warningCount ) {
cout << "\nSECOND PASS complete: " << valid_insts
cout << "\nSECOND PASS complete: " << valid_insts
<< " instances valid.\n";
sprintf( errbuf,
" %d ERRORS\t %d WARNINGS\n\n",
_errorCount, _warningCount );
_error.AppendToUserMsg( errbuf );
cout << errbuf;
}
sprintf( errbuf,
" %d ERRORS\t %d WARNINGS\n\n",
_errorCount, _warningCount );
_error.AppendToUserMsg( errbuf );
cout << errbuf;
//check for "ENDSTEP;" || "END-ISO-10303-21;"
@ -1796,24 +1753,18 @@ Severity STEPfile::AppendFile( istream * in, bool useTechCor ) {
}
if( ( strncmp( const_cast<char *>( keywd.c_str() ),
END_FILE_DELIM,
END_FILE_DELIM.c_str(),
strlen( const_cast<char *>( keywd.c_str() ) ) ) || !( in2 -> good() ) ) ) {
_error.AppendToUserMsg( END_FILE_DELIM );
_error.AppendToUserMsg( END_FILE_DELIM.c_str() );
_error.AppendToUserMsg( " missing at end of file.\n" );
CloseInputFile( in2 );
return _error.GreaterSeverity( SEVERITY_WARNING );
}
CloseInputFile( in2 );
if( _verbose || _errorCount || _warningCount ) {
cout << "Finished reading file.\n\n";
}
cout << "Finished reading file.\n\n";
return SEVERITY_NULL;
}
/******************************************************/
Severity STEPfile::WriteWorkingFile( ostream & out, int clearError, int writeComments ) {
SetFileType( WORKING_SESSION );
if( clearError ) {
@ -1835,9 +1786,8 @@ Severity STEPfile::WriteWorkingFile( ostream & out, int clearError, int writeCom
return _error.severity();
}
/******************************************************/
Severity STEPfile::WriteWorkingFile( const std::string filename, int clearError,
int writeComments ) {
int writeComments ) {
if( clearError ) {
_error.ClearErrorMsg();
}
@ -1851,9 +1801,6 @@ Severity STEPfile::WriteWorkingFile( const std::string filename, int clearError,
return rval;
}
/***************************
***************************/
void STEPfile::WriteWorkingData( ostream & out, int writeComments ) {
std::string currSch = schemaName();
out << "DATA;\n";
@ -1907,7 +1854,6 @@ Severity STEPfile::AppendEntityErrorMsg( ErrorDescriptor * e ) {
if( ( sev < SEVERITY_MAX ) || ( sev > SEVERITY_NULL ) ) {
//ERROR: something wrong with ErrorDescriptor
//_error.AppendToDetailMsg("Error: in AppendEntityErrorMsg(ErrorDesriptor& e). Incomplete ErrorDescriptor, unable to report error message in SDAI_Application_instance.\n");
_error.GreaterSeverity( SEVERITY_WARNING );
return SEVERITY_BUG;
}

View file

@ -1,5 +1,5 @@
#ifndef _STEPFILE_H
#define _STEPFILE_H
#define _STEPFILE_H
/*
* NIST STEP Core Class Library
@ -14,6 +14,7 @@
*/
#include <scl_export.h>
#include <string>
#include <instmgr.h>
#include <Registry.h>
#include <fstream>
@ -28,12 +29,10 @@
#define READ_INCOMPLETE 20
enum FileTypeCode {
TYPE_UNKNOWN = -2,
VERSION_OLD = -1,
VERSION_UNKNOWN = 0,
VERSION_CURRENT = 1,
WORKING_SESSION = 2,
OLD_WORKING_SESSION = 3
VERSION_OLD = -1,
VERSION_UNKNOWN = 0,
VERSION_CURRENT = 1,
WORKING_SESSION = 2
};
class SCL_EDITOR_EXPORT STEPfile {
@ -93,8 +92,8 @@ class SCL_EDITOR_EXPORT STEPfile {
//file type information
FileTypeCode _fileType;
char ENTITY_NAME_DELIM;
char * FILE_DELIM;
char * END_FILE_DELIM;
std::string FILE_DELIM;
std::string END_FILE_DELIM;
//public member functions
public:
@ -113,11 +112,11 @@ class SCL_EDITOR_EXPORT STEPfile {
SDAI_Application_instance * HeaderDefaultFileSchema();
//file information
const std::string FileName() const {
std::string FileName() const {
return _fileName;
}
const std::string SetFileName( const std::string name = "" );
const std::string TruncFileName( const std::string name ) const;
std::string SetFileName( const std::string name = "" );
std::string TruncFileName( const std::string name ) const;
float GetReadProgress() const;
float GetWriteProgress() const;
@ -143,13 +142,13 @@ class SCL_EDITOR_EXPORT STEPfile {
int SetFileType( FileTypeCode ft = VERSION_CURRENT );
//Reading and Writing
Severity ReadExchangeFile( const std::string filename = "", bool useTechCor = true );
Severity AppendExchangeFile( const std::string filename = "", bool useTechCor = true );
Severity ReadExchangeFile( const std::string filename = "", bool useTechCor = 1 );
Severity AppendExchangeFile( const std::string filename = "", bool useTechCor = 1 );
Severity ReadWorkingFile( const std::string filename = "", bool useTechCor = true );
Severity AppendWorkingFile( const std::string filename = "", bool useTechCor = true );
Severity ReadWorkingFile( const std::string filename = "", bool useTechCor = 1 );
Severity AppendWorkingFile( const std::string filename = "", bool useTechCor = 1 );
Severity AppendFile( istream * in, bool useTechCor = true ) ;
Severity AppendFile( istream * in, bool useTechCor = 1 ) ;
Severity WriteExchangeFile( ostream & out, int validate = 1,
int clearError = 1, int writeComments = 1 );
@ -169,12 +168,12 @@ class SCL_EDITOR_EXPORT STEPfile {
void Renumber();
//constructors
STEPfile( Registry & r, InstMgr & i, const std::string filename = "", bool strict = true, bool verbose = false );
STEPfile( Registry & r, InstMgr & i, const std::string filename = "", bool strict = true );
virtual ~STEPfile();
protected:
//member functions
const std::string schemaName(); /**< Returns and copies out schema name from header instances.
std::string schemaName(); /**< Returns and copies out schema name from header instances.
Called by ReadExchangeFile */
istream * OpenInputFile( const std::string filename = "" );
void CloseInputFile( istream * in );
@ -185,7 +184,7 @@ class SCL_EDITOR_EXPORT STEPfile {
void HeaderMergeInstances( InstMgr * im );
int HeaderId( int increment = 1 );
int HeaderId( const std::string name );
int HeaderId( const char * nm = "\0" );
int ReadData1( istream & in ); /**< First pass, to create instances */
int ReadData2( istream & in, bool useTechCor = true ); /**< Second pass, to read instances */
@ -197,17 +196,17 @@ class SCL_EDITOR_EXPORT STEPfile {
void ReadRestOfFile( istream & in );
/// create instance - used by ReadData1()
SDAI_Application_instance * CreateInstance( istream & in, ostream & out );
SDAI_Application_instance * CreateInstance( istream & in, ostream & out );
/// create complex instance - used by CreateInstance()
SDAI_Application_instance * CreateSubSuperInstance( istream & in, int fileid,
SDAI_Application_instance * CreateSubSuperInstance( istream & in, int fileid,
ErrorDescriptor & );
/// read the instance - used by ReadData2()
SDAI_Application_instance * ReadInstance( istream & in, ostream & out,
// read the instance - used by ReadData2()
SDAI_Application_instance * ReadInstance( istream & in, ostream & out,
std::string & cmtStr, bool useTechCor = true );
/// reading scopes are still incomplete, CreateScopeInstances and ReadScopeInstances are stubs
Severity CreateScopeInstances( istream & in, SDAI_Application_instance_ptr ** scopelist );
Severity CreateScopeInstances( istream & in, SDAI_Application_instance_ptr ** scopelist );
Severity ReadScopeInstances( istream & in );
// Severity ReadSubSuperInstance(istream& in);
@ -222,7 +221,7 @@ class SCL_EDITOR_EXPORT STEPfile {
void CloseOutputFile( ostream * out );
void WriteHeader( ostream & out );
void WriteHeaderInstance( SDAI_Application_instance * obj, ostream & out );
void WriteHeaderInstance( SDAI_Application_instance *obj, ostream & out );
void WriteHeaderInstanceFileName( ostream & out );
void WriteHeaderInstanceFileDescription( ostream & out );
void WriteHeaderInstanceFileSchema( ostream & out );

View file

@ -25,13 +25,14 @@ extern void HeaderSchemaInit( Registry & reg );
//constructor & destructor
STEPfile::STEPfile( Registry & r, InstMgr & i, const std::string filename, bool strict, bool verbose ) :
STEPfile::STEPfile( Registry & r, InstMgr & i, const std::string filename, bool strict ) :
_instances( i ), _reg( r ), _fileIdIncr( 0 ), _headerId( 0 ),
_entsNotCreated( 0 ), _entsInvalid( 0 ), _entsIncomplete( 0 ),
_entsWarning( 0 ), _errorCount( 0 ), _warningCount( 0 ),
_maxErrorCount( 5000 ), _strict( strict ), _verbose( verbose ),
_iFileSize( 0 ), _iFileCurrentPosition( 0 ),
_oFileInstsWritten( 0 ), _iFileStage1Done( false ) {
_maxErrorCount( 100000 ), _strict( strict ),_iFileSize( 0 ),
_iFileCurrentPosition( 0 ), _oFileInstsWritten( 0 ),
_iFileStage1Done( false )
{
SetFileType( VERSION_CURRENT );
SetFileIdIncrement();
_currentDir = new DirObj( "" );
@ -57,19 +58,19 @@ int STEPfile::SetFileType( FileTypeCode ft ) {
switch( _fileType ) {
case( VERSION_OLD ):
ENTITY_NAME_DELIM = '@';
FILE_DELIM = ( char * )"STEP;";
END_FILE_DELIM = ( char * )"ENDSTEP;";
FILE_DELIM = "STEP;";
END_FILE_DELIM = "ENDSTEP;";
break;
case( VERSION_UNKNOWN ):
case( VERSION_CURRENT ):
ENTITY_NAME_DELIM = '#';
FILE_DELIM = ( char * )"ISO-10303-21;";
END_FILE_DELIM = ( char * )"END-ISO-10303-21;";
FILE_DELIM = "ISO-10303-21;";
END_FILE_DELIM = "END-ISO-10303-21;";
break;
case( WORKING_SESSION ):
ENTITY_NAME_DELIM = '#';
FILE_DELIM = ( char * )"STEP_WORKING_SESSION;";
END_FILE_DELIM = ( char * )"END-STEP_WORKING_SESSION;";
FILE_DELIM = "STEP_WORKING_SESSION;";
END_FILE_DELIM = "END-STEP_WORKING_SESSION;";
break;
default:
@ -86,7 +87,7 @@ int STEPfile::SetFileType( FileTypeCode ft ) {
** remove any slashes, and anything before the slash,
** from filename
*/
const std::string STEPfile::TruncFileName( const std::string filename ) const {
std::string STEPfile::TruncFileName( const std::string filename ) const {
#if defined(__WIN32__) && !defined(__mingw32__)
char slash = '\\';
#else
@ -170,8 +171,6 @@ Severity STEPfile::AppendWorkingFile( const std::string filename, bool useTechCo
return rval;
}
/******************************************************/
istream * STEPfile::OpenInputFile( const std::string filename ) {
_iFileCurrentPosition = 0;
@ -227,7 +226,7 @@ void STEPfile::CloseInputFile( istream * in ) {
/******************************************************/
ofstream * STEPfile::OpenOutputFile( const std::string filename ) {
ofstream * STEPfile::OpenOutputFile( std::string filename ) {
if( filename.empty() ) {
if( FileName().empty() ) {
_error.AppendToUserMsg( "No current file name.\n" );
@ -259,28 +258,27 @@ void STEPfile::CloseOutputFile( ostream * out ) {
delete out;
}
/******************************************************/
int STEPfile::IncrementFileId( int fileid ) {
return ( fileid + FileIdIncr() );
}
void STEPfile::SetFileIdIncrement() {
if( instances().MaxFileId() < 0 ) {
_fileIdIncr = 0;
} else _fileIdIncr =
( int )( ( ceil( ( ( instances().MaxFileId() + 99.0 ) / 1000.0 ) ) + 1.0 ) * 1000.0 );
} else {
_fileIdIncr = ( int )( ( ceil( ( instances().MaxFileId() + 99.0 ) / 1000.0 ) + 1.0 ) * 1000.0 );
}
}
/**
* Returns the schema name from the file schema header section (or the 1st
* one if more than one exists). Copies this value into schName. If there
* is no header section or no value for file schema, NULL is returned and
* schName is unset.
*/
const std::string STEPfile::schemaName() {
std::string STEPfile::schemaName() {
SdaiFile_schema * fs;
std::string schName;
STEPnode * n;

View file

@ -7,7 +7,7 @@
#include <scl_export.h>
// Schema: SdaiHEADER_SECTION_SCHEMA
extern SCL_EDITOR_EXPORT Schema * s_header_section_schema;
extern Schema * s_header_section_schema;
// Types:
typedef SDAI_String SdaiTime_stamp_text;
@ -25,51 +25,63 @@ extern SCL_EDITOR_EXPORT TypeDescriptor * header_section_schemat_exchange
// Entities:
class SdaiSection_language;
typedef SdaiSection_language * SdaiSection_languageH;
typedef SdaiSection_language * SdaiSection_language_ptr;
typedef SdaiSection_language_ptr SdaiSection_language_var;
#define SdaiSection_language__set SDAI_DAObject__set
#define SdaiSection_language__set_var SDAI_DAObject__set_var
typedef SdaiSection_language * SdaiSection_languageH;
typedef SdaiSection_language * SdaiSection_language_ptr;
typedef SdaiSection_language_ptr SdaiSection_language_var;
typedef const SdaiSection_language * const_SdaiSection_languageH;
typedef const SdaiSection_language * const_SdaiSection_language_ptr;
#define SdaiSection_language__set SDAI_DAObject__set
#define SdaiSection_language__set_var SDAI_DAObject__set_var
extern SCL_EDITOR_EXPORT EntityDescriptor * header_section_schemae_section_language;
class SdaiFile_population;
typedef SdaiFile_population * SdaiFile_populationH;
typedef SdaiFile_population * SdaiFile_population_ptr;
typedef SdaiFile_population_ptr SdaiFile_population_var;
#define SdaiFile_population__set SDAI_DAObject__set
#define SdaiFile_population__set_var SDAI_DAObject__set_var
typedef SdaiFile_population * SdaiFile_populationH;
typedef SdaiFile_population * SdaiFile_population_ptr;
typedef SdaiFile_population_ptr SdaiFile_population_var;
typedef const SdaiFile_population * const_SdaiFile_populationH;
typedef const SdaiFile_population * const_SdaiFile_population_ptr;
#define SdaiFile_population__set SDAI_DAObject__set
#define SdaiFile_population__set_var SDAI_DAObject__set_var
extern SCL_EDITOR_EXPORT EntityDescriptor * header_section_schemae_file_population;
class SdaiFile_name;
typedef SdaiFile_name * SdaiFile_nameH;
typedef SdaiFile_name * SdaiFile_name_ptr;
typedef SdaiFile_name_ptr SdaiFile_name_var;
#define SdaiFile_name__set SDAI_DAObject__set
#define SdaiFile_name__set_var SDAI_DAObject__set_var
extern SCL_EDITOR_EXPORT EntityDescriptor * header_section_schemae_file_name;
typedef SdaiFile_name * SdaiFile_nameH;
typedef SdaiFile_name * SdaiFile_name_ptr;
typedef SdaiFile_name_ptr SdaiFile_name_var;
typedef const SdaiFile_name * const_SdaiFile_nameH;
typedef const SdaiFile_name * const_SdaiFile_name_ptr;
#define SdaiFile_name__set SDAI_DAObject__set
#define SdaiFile_name__set_var SDAI_DAObject__set_var
extern SCL_EDITOR_EXPORT EntityDescriptor * header_section_schemae_file_name;
class SdaiSection_context;
typedef SdaiSection_context * SdaiSection_contextH;
typedef SdaiSection_context * SdaiSection_context_ptr;
typedef SdaiSection_context_ptr SdaiSection_context_var;
#define SdaiSection_context__set SDAI_DAObject__set
#define SdaiSection_context__set_var SDAI_DAObject__set_var
extern SCL_EDITOR_EXPORT EntityDescriptor * header_section_schemae_section_context;
typedef SdaiSection_context * SdaiSection_contextH;
typedef SdaiSection_context * SdaiSection_context_ptr;
typedef SdaiSection_context_ptr SdaiSection_context_var;
typedef const SdaiSection_context * const_SdaiSection_contextH;
typedef const SdaiSection_context * const_SdaiSection_context_ptr;
#define SdaiSection_context__set SDAI_DAObject__set
#define SdaiSection_context__set_var SDAI_DAObject__set_var
extern SCL_EDITOR_EXPORT EntityDescriptor * header_section_schemae_section_context;
class SdaiFile_description;
typedef SdaiFile_description * SdaiFile_descriptionH;
typedef SdaiFile_description * SdaiFile_description_ptr;
typedef SdaiFile_description_ptr SdaiFile_description_var;
#define SdaiFile_description__set SDAI_DAObject__set
#define SdaiFile_description__set_var SDAI_DAObject__set_var
extern SCL_EDITOR_EXPORT EntityDescriptor * header_section_schemae_file_description;
typedef SdaiFile_description * SdaiFile_descriptionH;
typedef SdaiFile_description * SdaiFile_description_ptr;
typedef SdaiFile_description_ptr SdaiFile_description_var;
typedef const SdaiFile_description * const_SdaiFile_descriptionH;
typedef const SdaiFile_description * const_SdaiFile_description_ptr;
#define SdaiFile_description__set SDAI_DAObject__set
#define SdaiFile_description__set_var SDAI_DAObject__set_var
extern SCL_EDITOR_EXPORT EntityDescriptor * header_section_schemae_file_description;
class SdaiFile_schema;
typedef SdaiFile_schema * SdaiFile_schemaH;
typedef SdaiFile_schema * SdaiFile_schema_ptr;
typedef SdaiFile_schema_ptr SdaiFile_schema_var;
#define SdaiFile_schema__set SDAI_DAObject__set
#define SdaiFile_schema__set_var SDAI_DAObject__set_var
extern SCL_EDITOR_EXPORT EntityDescriptor * header_section_schemae_file_schema;
typedef SdaiFile_schema * SdaiFile_schemaH;
typedef SdaiFile_schema * SdaiFile_schema_ptr;
typedef SdaiFile_schema_ptr SdaiFile_schema_var;
typedef const SdaiFile_schema * const_SdaiFile_schemaH;
typedef const SdaiFile_schema * const_SdaiFile_schema_ptr;
#define SdaiFile_schema__set SDAI_DAObject__set
#define SdaiFile_schema__set_var SDAI_DAObject__set_var
extern SCL_EDITOR_EXPORT EntityDescriptor * header_section_schemae_file_schema;
#endif

View file

@ -30,50 +30,50 @@
#define NUM_CMD_COLUMNS 3
// **** each of CMD_CHAR must be a unique char.
#define SAVE_COMPLETE_CMD_CHAR 's'
#define SAVE_COMPLETE_CMD_COL 0
#define SAVE_COMPLETE_STATE_CHAR ' '
#define SAVE_COMPLETE_STATE_COL 4
#define SAVE_COMPLETE_CMD_CHAR 's'
#define SAVE_COMPLETE_CMD_COL 0
#define SAVE_COMPLETE_STATE_CHAR ' '
#define SAVE_COMPLETE_STATE_COL 4
#define SAVE_INCOMPLETE_CMD_CHAR 'i'
#define SAVE_INCOMPLETE_CMD_COL 0
#define SAVE_INCOMPLETE_STATE_CHAR 'I'
#define SAVE_INCOMPLETE_STATE_COL 4
#define SAVE_INCOMPLETE_CMD_CHAR 'i'
#define SAVE_INCOMPLETE_CMD_COL 0
#define SAVE_INCOMPLETE_STATE_CHAR 'I'
#define SAVE_INCOMPLETE_STATE_COL 4
// backup to last save
//#define CANCEL_CMD_CHAR 'c'
//#define CANCEL_CMD_COL 0
//#define CANCEL_CMD_CHAR 'c'
//#define CANCEL_CMD_COL 0
#define NEW_STATE_CHAR 'N'
#define NEW_STATE_COL 4
#define NEW_STATE_CHAR 'N'
#define NEW_STATE_COL 4
#define DELETE_CMD_CHAR 'd'
#define DELETE_CMD_COL 0
#define DELETE_STATE_CHAR 'D'
#define DELETE_STATE_COL 4
#define DELETE_CMD_CHAR 'd'
#define DELETE_CMD_COL 0
#define DELETE_STATE_CHAR 'D'
#define DELETE_STATE_COL 4
// close will try to save it to its previous status
#define CLOSE_CMD_CHAR 'c'
#define CLOSE_CMD_COL 2
#define CLOSE_CMD_CHAR 'c'
#define CLOSE_CMD_COL 2
#define MODIFY_CMD_CHAR 'm'
#define MODIFY_CMD_COL 2
#define MODIFY_STATE_CHAR 'M'
#define MODIFY_STATE_COL 3
#define MODIFY_CMD_CHAR 'm'
#define MODIFY_CMD_COL 2
#define MODIFY_STATE_CHAR 'M'
#define MODIFY_STATE_COL 3
#define VIEW_CMD_CHAR 'v'
#define VIEW_CMD_COL 2
#define VIEW_STATE_CHAR 'V'
#define VIEW_STATE_COL 3
#define VIEW_CMD_CHAR 'v'
#define VIEW_CMD_COL 2
#define VIEW_STATE_CHAR 'V'
#define VIEW_STATE_COL 3
#define REPLICATE_CMD_CHAR 'r'
#define REPLICATE_CMD_COL 1
#define REPLICATE_CMD_CHAR 'r'
#define REPLICATE_CMD_COL 1
#define EXECUTE_CMD_CHAR 'x'
#define EXECUTE_CMD_COL 5
#define EXECUTE_CMD_CHAR 'x'
#define EXECUTE_CMD_COL 5
#define UNMARK_CMD_CHAR 'u'
#define UNMARK_CMD_COL 5
#define UNMARK_CMD_CHAR 'u'
#define UNMARK_CMD_COL 5
///////////////////////////////////////////////////////////////////////////////
@ -149,7 +149,7 @@ class SCL_EDITOR_EXPORT CmdMgr {
// STATE LIST OPERATIONS
MgrNode * GetHead( stateEnum listType );
DisplayNode * GetHead( displayStateEnum listType );
ReplicateLinkNode * GetReplicateHead() {
ReplicateLinkNode * GetReplicateHead() {
return ( ReplicateLinkNode * )( replicateList->GetHead() );
}

View file

@ -28,7 +28,7 @@ class DisplayNodelist;
class SCL_EDITOR_EXPORT seeInfo : public DisplayNode {
public:
seeInfo( MgrNode * node,
SDAI_Application_instance * se,
SDAI_Application_instance *se,
DisplayNodeList * dnl, displayStateEnum displaySt = mappedWrite );
void * GetSEE() {
@ -36,7 +36,7 @@ class SCL_EDITOR_EXPORT seeInfo : public DisplayNode {
}
};
inline seeInfo::seeInfo( MgrNode * node, SDAI_Application_instance * se,
inline seeInfo::seeInfo( MgrNode * node, SDAI_Application_instance *se,
DisplayNodeList * dnl, displayStateEnum displaySt ) {
mn = node;
see = 0;

View file

@ -13,7 +13,6 @@
//#define EXCHANGE_FILE_DIR "\0"
#define EXCHANGE_FILE_DIR "~pdevel/src/probe/data"
#define WORKING_FILE_DIR "~pdevel/src/probe/data"
#define MAX_PATH_LEN 80
@ -1034,7 +1033,7 @@ void Probe::seeSaveComplete( StepEntityEditor * see ) {
std::string seText;
see->GetStepEntity()->STEPwrite( seText );
entityInstanceList->ReplaceText( seText.chars(), index ) ;
entityInstanceList->ReplaceText( seText.c_str(), index ) ;
entityInstanceList->WriteCmdChar( SAVE_COMPLETE_STATE_CHAR,
SAVE_COMPLETE_STATE_COL, index ); // write the state char
@ -1060,7 +1059,7 @@ void Probe::seeSaveIncomplete( StepEntityEditor * see ) {
std::string seText;
see->GetStepEntity()->STEPwrite( seText );
entityInstanceList->ReplaceText( seText.chars(), index );
entityInstanceList->ReplaceText( seText.c_str(), index );
entityInstanceList->WriteCmdChar( SAVE_INCOMPLETE_STATE_CHAR,
SAVE_INCOMPLETE_STATE_COL, index ); // write the state char
@ -1140,7 +1139,7 @@ void Probe::seeReplicate( StepEntityEditor * see ) {
see = ( StepEntityEditor * )dn->SEE();
seNew->STEPwrite( instanceInfo );
int index = entityInstanceList->Append( instanceInfo.chars() );
int index = entityInstanceList->Append( instanceInfo.c_str() );
mn->ArrayIndex( index );
entityInstanceList->WriteCmdChar( NEW_STATE_CHAR,
NEW_STATE_COL, index );
@ -1464,7 +1463,7 @@ int Probe::seeEntityEdit( StepEntityEditor * see ) {
// write the new instance to the instance display list
std::string instanceInfo;
newEntity->STEPwrite( instanceInfo );
int index = entityInstanceList->Append( instanceInfo.chars() );
int index = entityInstanceList->Append( instanceInfo.c_str() );
mn->ArrayIndex( index );
entityInstanceList->WriteCmdChar( NEW_STATE_CHAR,
NEW_STATE_COL, index );
@ -1615,9 +1614,7 @@ int Probe::seeSelectMark( StepEntityEditor * see ) {
attrVal[0] = 0;
strcpy( attrVal, attrRow->GetEditFieldText() );
int i = 0;
for( i = 0; attrVal[i] != '\0'; i++ ) {
;
}
for( i = 0; attrVal[i] != '\0'; i++ ) ;
if( i > 0 && !isspace( attrVal[i - 1] ) ) {
strcat( attrVal, ", " );
}
@ -1670,7 +1667,7 @@ void Probe::WriteInstance( int index ) {
MgrNode * mn = instMgr -> GetMgrNode( index );
mn->GetSTEPentity()->STEPwrite( instanceInfo );
entityInstanceList->Append( instanceInfo.chars() );
entityInstanceList->Append( instanceInfo.c_str() );
switch( mn->CurrState() ) {
/*
case completeSE:
@ -1950,7 +1947,7 @@ void Probe::CreateInstanceCmd() {
see = ( StepEntityEditor * )dn->SEE();
se->STEPwrite( instanceInfo );
int index = entityInstanceList->Append( instanceInfo.chars() );
int index = entityInstanceList->Append( instanceInfo.c_str() );
mn->ArrayIndex( index );
entityInstanceList->WriteCmdChar( NEW_STATE_CHAR,
NEW_STATE_COL, index );
@ -2928,7 +2925,7 @@ void Probe::sedlReplicate( MgrNode * existMN, int index ) {
StepEntityEditor * see = ( StepEntityEditor * )dn->SEE();
seNew->STEPwrite( instanceInfo );
int newIndex = entityInstanceList->Append( instanceInfo.chars() );
int newIndex = entityInstanceList->Append( instanceInfo.c_str() );
mn->ArrayIndex( newIndex );
entityInstanceList->WriteCmdChar( NEW_STATE_CHAR,
NEW_STATE_COL, newIndex );

View file

@ -47,38 +47,6 @@ extern struct Hash_Table * TypeDictionary;
extern Probe * dp;
/*
StepEntityDescriptor *GetStepEntityDescriptor(char *e)
{
// EntityDescriptor & entDesc =
// (EntityDescriptor *)HASHfind(EntityDictionary, StrToUpper(e));
// return new StepEntityDescriptor(entDesc);
}
*/
/*
Interactor *InsertInteractor (Interactor * i, Interactor * i2, Alignment align)
{
extern World* dp_world;
Frame* framedInteractor = new Frame(i, 2);
Coord x, y;
// if(i2->IsMapped()){
i2->Align(BottomCenter, i->GetShape()->width, i->GetShape()->height, x, y);
i2->GetRelative(x, y, dp_world);
dp_world->InsertTransient(framedInteractor, i2, x, y, align);
// } else {
// x = y = 0;
// dp_world->InsertTransient(framedInteractor, i2, x, y, align);
// }
return(framedInteractor);
}
//////////////////////////////////
*/
void RemoveInteractor( Interactor * i, Interactor * i2 ) {
Frame * framedInteractor = ( Frame * ) i->Parent();
@ -87,8 +55,6 @@ void RemoveInteractor( Interactor * i, Interactor * i2 ) {
delete framedInteractor;
}
//////////////////////////////////////////////////////////////////////////
Interactor * AddRightScroller( Interactor * grid ) {
return new HBox(
new MarginFrame( grid, 10 ),
@ -155,7 +121,6 @@ void EntityDescriptorBlock::Init( const EntityDescriptor * e, ButtonState * type
// determine the height of the box as the highest of the attribute
// box or subtype box.
int entryCount = max( attrCount, subtypeCount );
//////////////////
std::string str;
char endchar;
@ -172,57 +137,15 @@ void EntityDescriptorBlock::Init( const EntityDescriptor * e, ButtonState * type
str.Append( '<' );
endchar = '>';
}
/* // for when inverse information is included
else if( ad->Inverse() == OPLOG(LTrue) )
{
str.Append('(');
endchar = ')';
}
*/
std::string tmp;
str.Append( ad->AttrExprDefStr( tmp ) );
/* // built by hand
str.Append( ad->Name() );
str.Append( " : " );
if( ad->Optional() == OPLOG(LTrue) )
{
str.Append("OPTIONAL ");
}
str.Append( attrPtr->AttrDesc()->DomainType()->AttrTypeName() );
*/
str.Append( endchar );
////////////////////
attrListBrowser->Append( str.chars() );
/*
attrDefinition = str.chars();
const char *attrDefPtr = attrDefinition;
char attrStr[maxAttrLen + 1];
attrStr[0] = 0;
strncpy(attrStr, attrDefPtr, maxAttrLen);
attrStr[maxAttrLen] = 0;
attrListBrowser->Append(attrStr);
// if the attr def was longer than maxAttrLen continue the definition
// on lines following starting 5 spaces in.
attrDefPtr = &attrDefPtr[maxAttrLen];
while(strlen(attrDefPtr) > 0)
{
memset(attrStr, ' ', 5);
memset(attrStr + 5, 0, maxAttrLen - 4);
strncat(attrStr, attrDefPtr, maxAttrLen - 5);
attrListBrowser->Append(attrStr);
attrDefPtr = &attrDefPtr[strlen(attrStr) - 5];
}
*/
attrListBrowser->Append( str.c_str() );
attrPtr = ( AttrDescLinkNode * )attrPtr->NextNode();
}
//////////////
subtypeListBrowser = new StringBrowser( subtypeBS, entryCount, maxSubtypeLen );
EntityDescLinkNode * subtypePtr =
( EntityDescLinkNode * )subtypeList->GetHead();
@ -233,9 +156,6 @@ void EntityDescriptorBlock::Init( const EntityDescriptor * e, ButtonState * type
}
Interactor * EntityDescriptorBlock::Body() {
// Message *attrsAndSubtypesTitle = new Message("attributes & subtypes");
// Message *attrsTitle = new Message("attributes");
// Message *subtypesTitle = new Message("subtypes");
attrSubtypeBox = new HBox(
AddRightScroller( attrListBrowser ),
new VBorder,
@ -255,8 +175,6 @@ Interactor * EntityDescriptorBlock::Body() {
bodyBox = new VBox(
new HBox(
name,
// new HGlue(round(.02*inch), round(.02*inch), 0),
// attrsAndSubtypesTitle,
new HBox(
new HGlue( round( .5 * inch ), round( .5 * inch ), hfil ),
schemaMessage,
@ -264,7 +182,6 @@ Interactor * EntityDescriptorBlock::Body() {
openCloseBut
),
new HGlue( round( .02 * inch ), round( .02 * inch ), 0 )
// new HGlue(round(.5*inch), round(.5*inch), hfil)
),
new HBorder,
attrSubtypeBox
@ -290,9 +207,9 @@ void EntityDescriptorBlock::Update() {
( ( EntityDescriptor * )ed )->Subtypes().GetHead();
const EntityDescriptor * subtypeED;
if( !temp ) { // set error -- no subtypes found
if( !temp ) // set error -- no subtypes found
;
} else {
else {
subtypeED = ( ( EntityDescLinkNode * )temp ) -> EntityDesc();
}
@ -304,9 +221,9 @@ void EntityDescriptorBlock::Update() {
subtypeED = ( ( EntityDescLinkNode * )temp ) -> EntityDesc();
}
if( !temp ) { // set error -- subtype not found
if( !temp ) // set error -- subtype not found
;
} else {
else {
subtypeED = ( ( EntityDescLinkNode * )temp ) -> EntityDesc();
}
@ -333,26 +250,18 @@ void EntityDescriptorBlock::Update() {
attrPtr = ( AttrDescLinkNode * )attrPtr->NextNode();
}
std::string tmp;
// attrStr = attrPtr->AttrDesc()->AttrExprDefStr(tmp);
// attrStr = TypeString(attrPtr->AttrDesc());
std::string tmp2;
strncpy( attrStr,
attrPtr->AttrDesc()->DomainType()->TypeString( tmp2 ),
BUFSIZ );
attrStr[BUFSIZ - 1] = 0;
// AttrDescriptorList *attrDescList = ed->ExplicitAttr();
// AttrDescriptor *attrDesc = attrDescList->GetHead();
// char * attrStr = attrListBrowser->String(index);
typeMsg->SetValue( ( char * )attrStr );
cout << "Selected attr: '" << attrStr << "'\n";
}
}
openCloseBS->GetValue( val );
// openCloseBS->SetValue(0);
if( val != lastCloseVal ) {
if( val == 1 ) {
bodyBox->Remove( attrSubtypeBox );
@ -366,8 +275,6 @@ void EntityDescriptorBlock::Update() {
lastCloseVal = val;
}
///////////////////////////////////////////////////////////////////////////////
EntityDescBlockNode *
EntityDescBlockList::PrependNode( EntityDescriptorBlock * edb ) {
EntityDescBlockNode * node = ( EntityDescBlockNode * ) NewNode();
@ -382,23 +289,6 @@ EntityDescBlockList::PrependNode( EntityDescriptorBlock * edb ) {
return node;
}
///////////////////////////////////////////////////////////////////////////////
/*
StepEntityDescriptor::StepEntityDescriptor()
{
edbList = new EntityDescBlockList;
Scene::Insert(new HBorder(2));
entDesc = 0;
closeBS = new ButtonState(0);
closeBS->Attach(this);
close = new PushButton("close", closeBS, 1);
entDesc = ed;
}
*/
char *
StepEntityDescriptor::LongestAttrInBlock( const EntityDescriptor * entity ) {
int longestLen = 0;
@ -418,13 +308,6 @@ StepEntityDescriptor::LongestAttrInBlock( const EntityDescriptor * entity ) {
if( attrPtr->AttrDesc()->Derived() == LTrue ) {
attrLen = attrLen + 2;
}
/*
// for when inverse information is else included
else if( attrPtr->AttrDesc()->Inverse() == OPLOG(LTrue) )
{
attrLen = attrLen + 2;
}
*/
if( attrLen > longestLen ) {
strcpy( longestAttrStr, attrStr );
@ -469,7 +352,6 @@ StepEntityDescriptor::FindLongestAttribute() {
}
return longestAttrStr;
}
//////////////////
char *
StepEntityDescriptor::LongestSubtNameInBlock( const EntityDescriptor * entity ) {
@ -525,7 +407,6 @@ StepEntityDescriptor::FindLongestSubtName() {
}
return longestSubtypeStr;
}
//////////////////
StepEntityDescriptor::StepEntityDescriptor( const EntityDescriptor * ed ) {
entDesc = ed;
@ -546,8 +427,6 @@ StepEntityDescriptor::StepEntityDescriptor( const EntityDescriptor * ed ) {
)
);
///////////////
int maxAttrLen = strlen( FindLongestAttribute() );
int len = 5;
maxAttrLen = max( maxAttrLen, len );
@ -558,7 +437,6 @@ StepEntityDescriptor::StepEntityDescriptor( const EntityDescriptor * ed ) {
strDispBS = new ButtonState( 0 );
strDispBS->Attach( this );
strDisp = new StringDisplay( strDispBS, " " );
//////////////
edbList->PrependNode( new EntityDescriptorBlock( ed, strDispBS, maxAttrLen,
maxSubtypeLen ) );
@ -592,14 +470,6 @@ StepEntityDescriptor::StepEntityDescriptor( const EntityDescriptor * ed ) {
);
}
/*
StepEntityDescriptor::StepEntityDescriptor(Interactor *i) : (i)
{
edbList = new EntityDescBlockList;
Scene::Insert(new HBorder(2));
}
*/
void StepEntityDescriptor::Insert( Interactor * i ) {
Scene::Insert( i );
Scene::Insert( new HBorder( 2 ) );
@ -617,12 +487,9 @@ void StepEntityDescriptor::Update() {
closeBS->SetValue( 0 );
if( val == 1 ) {
dp->RemoveSED( this );
// RemoveInteractor (this, this);
cout << "close entity display" << "\n";
}
char * strVal = 0;
// strDispBS->GetValue(strVal); // this no longer works with Sun
// C++ => error. Must assign as below DAS
void * tmpVoidPtr = 0;
strDispBS->GetValue( tmpVoidPtr );
strVal = ( char * ) tmpVoidPtr;
@ -633,17 +500,6 @@ void StepEntityDescriptor::Update() {
}
}
// boolean i.e. true = 1 and false = 0
boolean StepEntityDescriptor::IsMapped() {
return ( canvas != nil && canvas->status() == Canvas::mapped );
/*
if(canvas)
{
// this doesn't work
int bool = canvas->window()->is_mapped();
return bool;
}
else
return false;
*/
}

View file

@ -388,22 +388,6 @@ void seeAttrRow::UndoChanges() {
if( stepAttr->NonRefType() == STRING_TYPE ) {
std::string tmp( attrVal );
attrVal = StrEditorVal( tmp );
/*
if(stepAttr->ptr.S->is_undefined())
attrVal = "$";
else
{
char *str = attrVal.chars();
while(isspace(*str)) str++;
if( (str[0] == '\\') && (str[1] == '$') )
{
str = str + 2;
while( isspace(*str) ) str++;
if(*str == '\0')
attrVal = "\\$"; // call value \$ a string with a single $
}
}
*/
}
// need to do the above assignment to save return val from asStr
editField->Message( attrVal );
@ -443,7 +427,7 @@ char * seeAttrRow::StrEditorVal( std::string & s ) {
if( stepAttr->ptr.S->is_undefined() ) {
s = "$";
} else {
char * str = ( char * )s.chars();
char * str = ( char * )s.c_str();
while( isspace( *str ) ) {
str++;
}
@ -457,7 +441,7 @@ char * seeAttrRow::StrEditorVal( std::string & s ) {
}
}
}
return ( char * )s.chars();
return ( char * )s.c_str();
}
// it was decided that attributes in the Data Probe of type string with value
@ -487,15 +471,12 @@ char * seeAttrRow::StrAttrAssignVal( const char * s ) {
}
if( *str == '\0' ) { // we will call value $ a string with nothing in it
return 0;
} else // a string value starting with a $ with following chars.
// stepAttr->StrToVal(QuotedString(s), dp->GetInstMgr(), 0);
{
} else { // a string value starting with a $ with following chars.
return ( char * )s;
}
// return QuotedString(s);
} else if( *str == '\0' ) {
// no value will be absence of a string
// stepAttr->ptr.S->set_undefined();
return "";
} else {
if( ( str[0] == '\\' ) && ( str[1] == '$' ) ) {
@ -1226,7 +1207,7 @@ void StepEntityEditor::CreateInsertAttributeEditors() {
}
s++;
}
label = new seeStringEditor( editorsButSt, ss.chars(), EDIT_WIDTH );
label = new seeStringEditor( editorsButSt, ss, EDIT_WIDTH );
} else {
label = new seeStringEditor( editorsButSt, " ", EDIT_WIDTH );
}
@ -1622,7 +1603,7 @@ boolean StepEntityEditor::SaveComplete() {
sTmp = ReadComment( ss, sTmp );
}
if( ss.rep() ) {
stepEnt->AddP21Comment( ss.chars() );
stepEnt->AddP21Comment( ss );
}
}
@ -1691,7 +1672,7 @@ boolean StepEntityEditor::SaveIncomplete() {
sTmp = ReadComment( ss, sTmp );
}
if( ss.rep() ) {
stepEnt->AddP21Comment( ss.chars() );
stepEnt->AddP21Comment( ss );
}
}
@ -1993,7 +1974,6 @@ void StepEntityEditor::Update() {
CheckButtons();
}
#ifdef firstWaySEEUpdate
// int buttonValue;
seeAttrRow * ptr;
SubordinateInfo * si = 0;
@ -2039,7 +2019,6 @@ void StepEntityEditor::Update() {
}
#endif
#ifdef secondWaySEEUpdate
// int buttonValue;
seeAttrRow * ptr;
Event e;

View file

@ -1,72 +1,62 @@
set(LIBSTEPCORE_SRCS
sdaiApplication_instance.cc
STEPcomplex.cc
STEPattribute.cc
STEPattribute.inline.cc
sdai.cc
sdaiSelect.cc
STEPaggregate.cc
STEPundefined.cc
STEPattributeList.cc
SingleLinkList.cc
SingleLinkList.inline.cc
Registry.inline.cc
ExpDict.cc
ExpDict.inline.cc
read_func.cc
collect.cc
complexlist.cc
entlist.cc
multlist.cc
orlist.cc
entnode.cc
non-ors.cc
match-ors.cc
trynext.cc
sdaiApplication_instance.cc
STEPcomplex.cc
STEPattribute.cc
STEPattribute.inline.cc
sdai.cc
sdaiSelect.cc
STEPaggregate.cc
STEPundefined.cc
STEPattributeList.cc
SingleLinkList.cc
SingleLinkList.inline.cc
Registry.inline.cc
ExpDict.cc
ExpDict.inline.cc
read_func.cc
collect.cc
complexlist.cc
entlist.cc
multlist.cc
orlist.cc
entnode.cc
non-ors.cc
match-ors.cc
trynext.cc
print.cc
instmgr.cc
mgrnode.cc
mgrnodearray.cc
mgrnodelist.cc
dispnode.cc
dispnodelist.cc
needFunc.cc
)
if(MINGW)
set(LIBDEPEND_SRCS
${SCL_SOURCE_DIR}/src/cleditor/instmgr.cc
${SCL_SOURCE_DIR}/src/cleditor/mgrnode.cc
${SCL_SOURCE_DIR}/src/cleditor/dispnode.cc
${SCL_SOURCE_DIR}/src/cleditor/mgrnodearray.cc
${SCL_SOURCE_DIR}/src/cleditor/needFunc.cc
)
endif(MINGW)
if(MSVC OR BORLAND)
set(LIBDEPEND_SRCS
${SCL_SOURCE_DIR}/src/cleditor/instmgr.cc
${SCL_SOURCE_DIR}/src/cleditor/mgrnode.cc
${SCL_SOURCE_DIR}/src/cleditor/dispnode.cc
${SCL_SOURCE_DIR}/src/cleditor/mgrnodearray.cc
${SCL_SOURCE_DIR}/src/cleditor/needFunc.cc
)
endif()
SET(LIBSTEPCORE_PRIVATE_HDRS
baseType.h
complexSupport.h
dictdefs.h
ExpDict.h
read_func.h
Registry.h
sdaiApplication_instance.h
sdaiBinary.h
sdaiEnum.h
sdai.h
sdaiSelect.h
sdaiString.h
Select.h
SingleLinkList.h
STEPaggregate.h
STEPattribute.h
STEPattributeList.h
STEPcomplex.h
baseType.h
complexSupport.h
dictdefs.h
ExpDict.h
read_func.h
Registry.h
sdaiApplication_instance.h
sdai.h
sdaiSelect.h
SingleLinkList.h
STEPaggregate.h
STEPattribute.h
STEPattributeList.h
STEPcomplex.h
STEPundefined.h
instmgr.h
mgrnode.h
mgrnodearray.h
mgrnodelist.h
dispnode.h
dispnodelist.h
needFunc.h
)
include_directories(
@ -77,4 +67,4 @@ include_directories(
${SCL_SOURCE_DIR}/src/clutils
)
SCL_ADDLIB(stepcore "${LIBSTEPCORE_SRCS} ${LIBDEPEND_SRCS}" "express steputils stepdai base")
SCL_ADDLIB(stepcore "${LIBSTEPCORE_SRCS}" "express;steputils;stepdai;base")

View file

@ -321,7 +321,6 @@ Interface_spec::~Interface_spec() {
}
//////////////////////////////////////////////////////////////////////////////
void Schema::AddFunction( const std::string & f ) {
_function_list.push_back( f );
}
@ -584,7 +583,7 @@ const char * AttrDescriptor::AttrExprDefStr( std::string & s ) const {
return const_cast<char *>( s.c_str() );
}
const PrimitiveType AttrDescriptor::BaseType() const {
PrimitiveType AttrDescriptor::BaseType() const {
if( _domainType ) {
return _domainType->BaseType();
}
@ -595,7 +594,7 @@ int AttrDescriptor::IsAggrType() const {
return ReferentType()->IsAggrType();
}
const PrimitiveType AttrDescriptor::AggrElemType() const {
PrimitiveType AttrDescriptor::AggrElemType() const {
if( IsAggrType() ) {
return ReferentType()->AggrElemType();
}
@ -616,14 +615,16 @@ const TypeDescriptor * AttrDescriptor::NonRefTypeDescriptor() const {
return 0;
}
const PrimitiveType AttrDescriptor::NonRefType() const {
PrimitiveType
AttrDescriptor::NonRefType() const {
if( _domainType ) {
return _domainType->NonRefType();
}
return UNKNOWN_TYPE;
}
const PrimitiveType AttrDescriptor::Type() const {
PrimitiveType
AttrDescriptor::Type() const {
if( _domainType ) {
return _domainType->Type();
}
@ -645,7 +646,8 @@ const char * AttrDescriptor::TypeName() const {
}
/// an expanded right side of attr def
const char * AttrDescriptor::ExpandedTypeName( std::string & s ) const {
const char *
AttrDescriptor::ExpandedTypeName( std::string & s ) const {
s.clear();
if( Derived() == LTrue ) {
s = "DERIVE ";
@ -814,7 +816,7 @@ const char * EntityDescriptor::GenerateExpress( std::string & buf ) const {
if( strlen( _supertype_stmt.c_str() ) > 0 ) {
buf.append( "\n " );
}
buf.append( _supertype_stmt.c_str() );
buf.append( _supertype_stmt );
const EntityDescriptor * ed = 0;
@ -952,13 +954,14 @@ const char * EntityDescriptor::QualifiedName( std::string & s ) const {
EntityDescItr edi( _supertypes );
int count = 1;
const EntityDescriptor * ed = 0;
while( ( ed = edi.NextEntityDesc() ) ) {
const EntityDescriptor * ed = edi.NextEntityDesc();
while( ed ) {
if( count > 1 ) {
s.append( "&" );
}
s.append( ed->Name() );
count++;
ed = edi.NextEntityDesc();
}
if( count > 1 ) {
s.append( "&" );
@ -990,8 +993,6 @@ const EntityDescriptor * EntityDescriptor::IsA( const EntityDescriptor * other )
return found;
}
///////////////////////////////////////////////////////////////////////////////
Type_or_rule::Type_or_rule() {
}
@ -1001,13 +1002,10 @@ Type_or_rule::Type_or_rule( const Type_or_rule & tor ) {
Type_or_rule::~Type_or_rule() {
}
///////////////////////////////////////////////////////////////////////////////
Where_rule::Where_rule() {
_type_or_rule = 0;
}
Where_rule::Where_rule( const Where_rule & wr ) {
_label = wr._label;
_type_or_rule = wr._type_or_rule;
@ -1116,7 +1114,6 @@ Uniqueness_rule::Uniqueness_rule()
: _parent_entity( 0 ) {
}
Uniqueness_rule::Uniqueness_rule( const Uniqueness_rule & ur ) {
_label = ur._label;
_parent_entity = ur._parent_entity;
@ -1565,7 +1562,7 @@ const TypeDescriptor * TypeDescriptor::IsA( const char * other ) const {
* an element by calling AggrElemType(). Select types
* would work the same?
*/
const PrimitiveType TypeDescriptor::NonRefType() const {
PrimitiveType TypeDescriptor::NonRefType() const {
const TypeDescriptor * td = NonRefTypeDescriptor();
if( td ) {
return td->FundamentalType();
@ -1602,7 +1599,7 @@ int TypeDescriptor::IsAggrType() const {
}
}
const PrimitiveType TypeDescriptor::AggrElemType() const {
PrimitiveType TypeDescriptor::AggrElemType() const {
const TypeDescriptor * aggrElemTD = AggrElemTypeDescriptor();
if( aggrElemTD ) {
return aggrElemTD->Type();
@ -1629,7 +1626,7 @@ const TypeDescriptor * TypeDescriptor::AggrElemTypeDescriptor() const {
* TypeDescriptor *BaseTypeDescriptor() returns the TypeDescriptor
* for Integer
*/
const PrimitiveType TypeDescriptor::BaseType() const {
PrimitiveType TypeDescriptor::BaseType() const {
const TypeDescriptor * td = BaseTypeDescriptor();
if( td ) {
return td->FundamentalType();
@ -1680,16 +1677,17 @@ const TypeDescriptor * SelectTypeDescriptor::IsA( const TypeDescriptor * other )
* type may be an element of a td for a select that is returned.
*/
const TypeDescriptor * SelectTypeDescriptor::CanBe( const TypeDescriptor * other ) const {
TypeDescItr elements( GetElements() ) ;
const TypeDescriptor * td = 0;
if( this == other ) {
return other;
}
while( ( td = elements.NextTypeDesc() ) ) {
TypeDescItr elements( GetElements() ) ;
const TypeDescriptor * td = elements.NextTypeDesc();
while( td ) {
if( td -> CanBe( other ) ) {
return td;
}
td = elements.NextTypeDesc();
}
return 0;
}
@ -1709,7 +1707,7 @@ const TypeDescriptor * SelectTypeDescriptor::CanBe( const char * other ) const {
}
// see if other is one of the elements
while( ( td = elements.NextTypeDesc() ) ) {
while( td = elements.NextTypeDesc() ) {
if( td -> CanBe( other ) ) {
return td;
}
@ -1738,9 +1736,9 @@ const TypeDescriptor * SelectTypeDescriptor::CanBe( const char * other ) const {
*/
const TypeDescriptor * SelectTypeDescriptor::CanBeSet( const char * other, const char * schNm ) const {
TypeDescItr elements( GetElements() ) ;
const TypeDescriptor * td = 0;
const TypeDescriptor * td = elements.NextTypeDesc();
while( ( td = elements.NextTypeDesc() ) ) {
while( td ) {
if( td->Type() == REFERENCE_TYPE && td->NonRefType() == sdaiSELECT ) {
// Just look at this level, don't look at my items (see intro).
if( td->CurrName( other, schNm ) ) {
@ -1749,6 +1747,7 @@ const TypeDescriptor * SelectTypeDescriptor::CanBeSet( const char * other, const
} else if( td->CanBeSet( other, schNm ) ) {
return td;
}
td = elements.NextTypeDesc();
}
return 0;
}
@ -1765,16 +1764,19 @@ STEPaggregate * AggrTypeDescriptor::CreateAggregate() {
}
}
void AggrTypeDescriptor::AssignAggrCreator(AggregateCreator f) {
CreateNewAggr = f;
}
AggrTypeDescriptor::AggrTypeDescriptor( ) :
_uniqueElements( ( char * )"UNKNOWN_TYPE" ) {
_uniqueElements( "UNKNOWN_TYPE" ) {
_bound1 = -1;
_bound2 = -1;
_aggrDomainType = 0;
}
AggrTypeDescriptor::AggrTypeDescriptor( SDAI_Integer b1,
SDAI_Integer b2,
AggrTypeDescriptor::AggrTypeDescriptor( SDAI_Integer b1,
SDAI_Integer b2,
Logical uniqElem,
TypeDescriptor * aggrDomType )
: _bound1( b1 ), _bound2( b2 ), _uniqueElements( uniqElem ) {

View file

@ -15,12 +15,11 @@
#include <scl_export.h>
#include <sdai.h>
#include <deque>
#include <vector>
#include <string>
#include <assert.h>
class SDAI_Application_instance;
typedef SDAI_Application_instance * ( * Creator )() ;
typedef SDAI_Application_instance * ( * Creator )();
enum AttrType_Enum {
AttrType_Explicit = 0,
@ -478,7 +477,7 @@ class SCL_CORE_EXPORT Where_rule : public Dictionary_instance {
Express_id label_() const {
return _label;
}
const Type_or_rule_var parent_item() const {
Type_or_rule_var parent_item() const {
return _type_or_rule;
}
std::string comment_() const {
@ -538,17 +537,17 @@ class SCL_CORE_EXPORT Global_rule : public Dictionary_instance {
Express_id name_() const {
return _name;
}
const Entity__set_var entities_() const {
Entity__set_var entities_() const {
return _entities;
}
const Where_rule__list_var where_rules_() const {
Where_rule__list_var where_rules_() const {
return _where_rules;
}
const Schema_ptr parent_schema_() const {
Schema_ptr parent_schema_() const {
return _parent_schema;
}
const char * rule_text_() {
return const_cast<char *>( _rule_text.c_str() );
return _rule_text.c_str();
}
void name_( Express_id & n ) {
@ -655,7 +654,7 @@ class SCL_CORE_EXPORT Uniqueness_rule__set {
typedef Uniqueness_rule__set * Uniqueness_rule__set_ptr;
typedef Uniqueness_rule__set_ptr Uniqueness_rule__set_var;
typedef SDAI_Model_contents_ptr( * ModelContentsCreator )() ;
typedef SDAI_Model_contents_ptr( * ModelContentsCreator )();
/**
* \class Schema (was SchemaDescriptor) - a class of this type is generated and contains schema info.
@ -663,7 +662,7 @@ typedef SDAI_Model_contents_ptr( * ModelContentsCreator )() ;
class SCL_CORE_EXPORT Schema : public Dictionary_instance {
protected:
const char * _name ;
const char * _name;
EntityDescriptorList _entList; // list of entities in the schema
TypeDescriptorList _typeList; // list of types in the schema
TypeDescriptorList _unnamed_typeList; // list of unnamed types in the schema (for cleanup)
@ -672,8 +671,8 @@ class SCL_CORE_EXPORT Schema : public Dictionary_instance {
// non-SDAI lists
Interface_spec__set_var _use_interface_list; // list of USE interfaces
Interface_spec__set_var _ref_interface_list; // list of REFERENCE interfaces
std::deque< std::string > _function_list; // of EXPRESS functions
std::deque< std::string > _procedure_list; // of EXPRESS procedures
std::vector< std::string > _function_list; // of EXPRESS functions
std::vector< std::string > _procedure_list; // of EXPRESS procedures
Global_rule__set_var _global_rules;
@ -687,7 +686,7 @@ class SCL_CORE_EXPORT Schema : public Dictionary_instance {
CreateNewModelContents = f;
}
const char * Name() const {
const char * Name() const {
return _name;
}
void Name( const char * n ) {
@ -707,7 +706,7 @@ class SCL_CORE_EXPORT Schema : public Dictionary_instance {
return _ref_interface_list;
}
std::deque< std::string > function_list_() {
std::vector< std::string > function_list_() {
return _function_list;
}
@ -721,7 +720,7 @@ class SCL_CORE_EXPORT Schema : public Dictionary_instance {
void global_rules_( Global_rule__set_var & grs ); // not implemented
std::deque< std::string > procedure_list_() {
std::vector< std::string > procedure_list_() {
return _procedure_list;
}
@ -857,20 +856,20 @@ class SCL_CORE_EXPORT InverseAItr {
class SCL_CORE_EXPORT AttrDescriptor {
protected:
const char * _name ; // the attributes name
const char * _name; // the attributes name
// this defines the domain of the attribute
const TypeDescriptor * _domainType ;
const TypeDescriptor * _domainType;
SDAI_LOGICAL _optional;
SDAI_LOGICAL _unique;
AttrType_Enum _attrType; // former attribute _derived
const EntityDescriptor & _owner ; // the owning entityDescriptor
const EntityDescriptor & _owner; // the owning entityDescriptor
public:
AttrDescriptor(
const char * name, // i.e. char *
const char * name, // i.e. char *
const TypeDescriptor * domainType,
Logical optional, // i.e. F U or T
Logical unique, // i.e. F U or T
Logical optional, // i.e. F U or T
Logical unique, // i.e. F U or T
AttrType_Enum at,// AttrType_Explicit, AttrType_Inverse,
// AttrType_Deriving,AttrType_Redefining
const EntityDescriptor & owner
@ -883,7 +882,7 @@ class SCL_CORE_EXPORT AttrDescriptor {
virtual const char * AttrExprDefStr( std::string & s ) const;
// left side of attr def
const char * Name() const {
const char * Name() const {
return _name;
}
void Name( const char * n ) {
@ -905,7 +904,7 @@ class SCL_CORE_EXPORT AttrDescriptor {
// for the first two and a TypeDescriptor for an
// aggregate for the last.
const PrimitiveType BaseType() const;
PrimitiveType BaseType() const;
const TypeDescriptor * BaseTypeDescriptor() const;
// the first PrimitiveType that is not REFERENCE_TYPE (the first
@ -916,21 +915,21 @@ class SCL_CORE_EXPORT AttrDescriptor {
// an element by calling AggrElemType(). Select types
// would work the same?
const PrimitiveType NonRefType() const;
PrimitiveType NonRefType() const;
const TypeDescriptor * NonRefTypeDescriptor() const;
int IsAggrType() const;
const PrimitiveType AggrElemType() const;
PrimitiveType AggrElemType() const;
const TypeDescriptor * AggrElemTypeDescriptor() const;
// The type of the attributes TypeDescriptor
const PrimitiveType Type() const;
const char * TypeName() const; // right side of attr def
PrimitiveType Type() const;
const char * TypeName() const; // right side of attr def
// an expanded right side of attr def
const char * ExpandedTypeName( std::string & s ) const;
int RefersToType() const {
int RefersToType() const {
return !( _domainType == 0 );
}
@ -950,11 +949,11 @@ class SCL_CORE_EXPORT AttrDescriptor {
const SDAI_LOGICAL & Optional() const {
return _optional;
}
void Optional( SDAI_LOGICAL & opt ) {
void Optional( SDAI_LOGICAL & opt ) {
_optional.put( opt.asInt() );
}
void Optional( Logical opt ) {
void Optional( Logical opt ) {
_optional.put( opt );
}
void Optional( const char * opt ) {
@ -964,13 +963,13 @@ class SCL_CORE_EXPORT AttrDescriptor {
const SDAI_LOGICAL & Unique() const {
return _unique;
}
void Unique( SDAI_LOGICAL uniq ) {
void Unique( SDAI_LOGICAL uniq ) {
_unique.put( uniq.asInt() );
}
void Unique( Logical uniq ) {
void Unique( Logical uniq ) {
_unique.put( uniq );
}
void Unique( const char * uniq ) {
void Unique( const char * uniq ) {
_unique.put( uniq );
}
@ -1000,27 +999,27 @@ class SCL_CORE_EXPORT AttrDescriptor {
void Optionality( SDAI_LOGICAL & opt ) {
_optional.put( opt.asInt() );
}
void Optionality( Logical opt ) {
void Optionality( Logical opt ) {
_optional.put( opt );
}
void Optionality( const char * opt ) {
_optional.put( opt );
}
const SDAI_LOGICAL & Uniqueness() const {
const SDAI_LOGICAL & Uniqueness() const {
return _unique;
}
void Uniqueness( SDAI_LOGICAL uniq ) {
void Uniqueness( SDAI_LOGICAL uniq ) {
_unique.put( uniq.asInt() );
}
void Uniqueness( Logical uniq ) {
void Uniqueness( Logical uniq ) {
_unique.put( uniq );
}
void Uniqueness( const char * uniq ) {
void Uniqueness( const char * uniq ) {
_unique.put( uniq );
}
const EntityDescriptor & Owner() const {
const EntityDescriptor & Owner() const {
return _owner;
}
};
@ -1064,7 +1063,7 @@ class SCL_CORE_EXPORT Inverse_attribute : public AttrDescriptor {
const char * _inverted_attr_id;
const char * _inverted_entity_id;
protected:
AttrDescriptor * _inverted_attr ; // not implemented
AttrDescriptor * _inverted_attr; // not implemented
public:
Inverse_attribute(
@ -1109,7 +1108,7 @@ class SCL_CORE_EXPORT Inverse_attribute : public AttrDescriptor {
}
// below are obsolete (and not implemented anyway)
class AttrDescriptor * InverseAttribute() const {
class AttrDescriptor * InverseAttribute() {
return _inverted_attr;
}
void InverseOf( AttrDescriptor * invAttr ) {
@ -1266,18 +1265,18 @@ class SCL_CORE_EXPORT TypeDescriptor {
// the type of the type (see above).
// it is an enum see file clstepcore/baseType.h
PrimitiveType _fundamentalType ;
PrimitiveType _fundamentalType;
const Schema * _originatingSchema;
// further describes the type (see above)
// most often (or always) points at a subtype.
const TypeDescriptor * _referentType ;
const TypeDescriptor * _referentType;
// Express file description (see above)
// e.g. the right side of an Express TYPE stmt
// (See note above by _name regarding memory allocation.)
const char * _description ;
const char * _description;
public:
// a Where_rule may contain only a comment
@ -1336,10 +1335,10 @@ class SCL_CORE_EXPORT TypeDescriptor {
const char * TypeString( std::string & s ) const;
// This TypeDescriptor's type
const PrimitiveType Type() const {
PrimitiveType Type() const {
return _fundamentalType;
}
void Type( const PrimitiveType type ) {
void Type( const PrimitiveType type ) {
_fundamentalType = type;
}
@ -1353,7 +1352,7 @@ class SCL_CORE_EXPORT TypeDescriptor {
// each one, PrimitiveType BaseType() will return INTEGER_TYPE.
// TypeDescriptor *BaseTypeDescriptor() returns the TypeDescriptor
// for Integer.
const PrimitiveType BaseType() const;
PrimitiveType BaseType() const;
const TypeDescriptor * BaseTypeDescriptor() const;
const char * BaseTypeName() const;
@ -1365,14 +1364,14 @@ class SCL_CORE_EXPORT TypeDescriptor {
// an element by calling AggrElemType(). Select types
// would work the same?
const PrimitiveType NonRefType() const;
PrimitiveType NonRefType() const;
const TypeDescriptor * NonRefTypeDescriptor() const;
int IsAggrType() const;
const PrimitiveType AggrElemType() const;
PrimitiveType AggrElemType() const;
const TypeDescriptor * AggrElemTypeDescriptor() const;
const PrimitiveType FundamentalType() const {
PrimitiveType FundamentalType() const {
return _fundamentalType;
}
void FundamentalType( PrimitiveType ftype ) {
@ -1405,7 +1404,7 @@ class SCL_CORE_EXPORT TypeDescriptor {
// A description of this type's type. Basically you
// get the right side of a TYPE statement minus END_TYPE.
// For base type TypeDescriptors it is the same as _name.
const char * Description() const {
const char * Description() const {
return _description;
}
void Description( const char * desc ) {
@ -1432,7 +1431,7 @@ class SCL_CORE_EXPORT TypeDescriptor {
// is USE/REFERENCE'ing us (added to altNames).
};
typedef SDAI_Enum * ( * EnumCreator )() ;
typedef SDAI_Enum * ( * EnumCreator )();
class SCL_CORE_EXPORT EnumTypeDescriptor : public TypeDescriptor {
public:
@ -1475,7 +1474,7 @@ class SCL_CORE_EXPORT EntityDescriptor : public TypeDescriptor {
EntityDescriptorList _subtypes; // OPTIONAL
EntityDescriptorList _supertypes; // OPTIONAL
AttrDescriptorList _explicitAttr; // OPTIONAL
AttrDescriptorList _explicitAttr; // OPTIONAL
Inverse_attributeList _inverseAttr; // OPTIONAL
std::string _supertype_stmt;
public:
@ -1595,7 +1594,7 @@ class SCL_CORE_EXPORT EntityDescriptor : public TypeDescriptor {
class SCL_CORE_EXPORT EnumerationTypeDescriptor : public TypeDescriptor {
protected:
StringAggregate * _elements ; // of (null)
StringAggregate * _elements; // of (null)
public:
EnumerationTypeDescriptor( );
@ -1619,15 +1618,15 @@ class BinaryAggregate;
class RealAggregate;
class IntAggregate;
typedef STEPaggregate * ( * AggregateCreator )() ;
typedef EnumAggregate * ( * EnumAggregateCreator )() ;
typedef GenericAggregate * ( * GenericAggregateCreator )() ;
typedef EntityAggregate * ( * EntityAggregateCreator )() ;
typedef SelectAggregate * ( * SelectAggregateCreator )() ;
typedef StringAggregate * ( * StringAggregateCreator )() ;
typedef BinaryAggregate * ( * BinaryAggregateCreator )() ;
typedef RealAggregate * ( * RealAggregateCreator )() ;
typedef IntAggregate * ( * IntAggregateCreator )() ;
typedef STEPaggregate * ( * AggregateCreator )();
typedef EnumAggregate * ( * EnumAggregateCreator )();
typedef GenericAggregate * ( * GenericAggregateCreator )();
typedef EntityAggregate * ( * EntityAggregateCreator )();
typedef SelectAggregate * ( * SelectAggregateCreator )();
typedef StringAggregate * ( * StringAggregateCreator )();
typedef BinaryAggregate * ( * BinaryAggregateCreator )();
typedef RealAggregate * ( * RealAggregateCreator )();
typedef IntAggregate * ( * IntAggregateCreator )();
SCL_CORE_EXPORT EnumAggregate * create_EnumAggregate();
@ -1663,8 +1662,8 @@ class SCL_CORE_EXPORT AggrTypeDescriptor : public TypeDescriptor {
protected:
SDAI_Integer _bound1, _bound2;
SDAI_LOGICAL _uniqueElements ;
TypeDescriptor * _aggrDomainType ;
SDAI_LOGICAL _uniqueElements;
TypeDescriptor * _aggrDomainType;
AggregateCreator CreateNewAggr;
AggrBoundTypeEnum _bound1_type, _bound2_type;
@ -1673,9 +1672,7 @@ class SCL_CORE_EXPORT AggrTypeDescriptor : public TypeDescriptor {
public:
void AssignAggrCreator( AggregateCreator f = 0 ) {
CreateNewAggr = f;
}
void AssignAggrCreator( AggregateCreator f = 0 );
STEPaggregate * CreateAggregate();
@ -1686,7 +1683,7 @@ class SCL_CORE_EXPORT AggrTypeDescriptor : public TypeDescriptor {
AggrTypeDescriptor( const char * nm, PrimitiveType ft,
Schema * origSchema, const char * d,
AggregateCreator f = 0 )
: TypeDescriptor( nm, ft, origSchema, d ), CreateNewAggr( f ) { }
: TypeDescriptor( nm, ft, origSchema, d ), _bound1(0), _bound2(0), _uniqueElements(0), _aggrDomainType( NULL ), CreateNewAggr( f ) { }
virtual ~AggrTypeDescriptor();
@ -1754,7 +1751,7 @@ class SCL_CORE_EXPORT AggrTypeDescriptor : public TypeDescriptor {
_bound2_type = bound_funcall;
}
SDAI_LOGICAL & UniqueElements() {
SDAI_LOGICAL & UniqueElements() {
return _uniqueElements;
}
void UniqueElements( SDAI_LOGICAL & ue ) {
@ -1781,23 +1778,23 @@ class SCL_CORE_EXPORT AggrTypeDescriptor : public TypeDescriptor {
class SCL_CORE_EXPORT ArrayTypeDescriptor : public AggrTypeDescriptor {
protected:
SDAI_LOGICAL _optionalElements ;
SDAI_LOGICAL _optionalElements;
public:
ArrayTypeDescriptor( ) : _optionalElements( ( char * )"UNKNOWN_TYPE" ) { }
ArrayTypeDescriptor( ) : _optionalElements( "UNKNOWN_TYPE" ) { }
ArrayTypeDescriptor( Logical optElem ) : _optionalElements( optElem )
{ }
ArrayTypeDescriptor( const char * nm, PrimitiveType ft,
Schema * origSchema, const char * d,
AggregateCreator f = 0 )
: AggrTypeDescriptor( nm, ft, origSchema, d, f ),
_optionalElements( ( char * )"UNKNOWN_TYPE" )
_optionalElements( "UNKNOWN_TYPE" )
{ }
virtual ~ArrayTypeDescriptor() {}
SDAI_LOGICAL & OptionalElements() {
SDAI_LOGICAL & OptionalElements() {
return _optionalElements;
}
void OptionalElements( SDAI_LOGICAL & oe ) {
@ -1852,12 +1849,12 @@ class SCL_CORE_EXPORT BagTypeDescriptor : public AggrTypeDescriptor {
};
typedef SDAI_Select * ( * SelectCreator )() ;
typedef SDAI_Select * ( * SelectCreator )();
class SCL_CORE_EXPORT SelectTypeDescriptor : public TypeDescriptor {
protected:
TypeDescriptorList _elements ; // of TYPE_DESCRIPTOR
TypeDescriptorList _elements; // of TYPE_DESCRIPTOR
int _unique_elements;
public:
@ -1900,30 +1897,30 @@ class SCL_CORE_EXPORT SelectTypeDescriptor : public TypeDescriptor {
class SCL_CORE_EXPORT StringTypeDescriptor : public TypeDescriptor {
protected:
SDAI_Integer _width ; // OPTIONAL
SDAI_LOGICAL _fixedSize ;
SDAI_Integer _width; // OPTIONAL
SDAI_LOGICAL _fixedSize;
public:
StringTypeDescriptor( ) : _fixedSize( ( char * )"UNKNOWN_TYPE" ) {
StringTypeDescriptor( ) : _fixedSize( "UNKNOWN_TYPE" ) {
_width = 0;
}
virtual ~StringTypeDescriptor() { }
SDAI_Integer Width() {
SDAI_Integer Width() {
return _width;
}
void Width( SDAI_Integer w ) {
void Width( SDAI_Integer w ) {
_width = w;
}
SDAI_LOGICAL & FixedSize() {
SDAI_LOGICAL & FixedSize() {
return _fixedSize;
}
void FixedSize( SDAI_LOGICAL fs ) {
void FixedSize( SDAI_LOGICAL fs ) {
_fixedSize.put( fs.asInt() );
}
void FixedSize( Logical fs ) {
void FixedSize( Logical fs ) {
_fixedSize.put( fs );
}
};
@ -1931,7 +1928,7 @@ class SCL_CORE_EXPORT StringTypeDescriptor : public TypeDescriptor {
class SCL_CORE_EXPORT RealTypeDescriptor : public TypeDescriptor {
protected:
SDAI_Integer _precisionSpec ; // OPTIONAL
SDAI_Integer _precisionSpec; // OPTIONAL
public:
RealTypeDescriptor( ) {
@ -1939,10 +1936,10 @@ class SCL_CORE_EXPORT RealTypeDescriptor : public TypeDescriptor {
}
virtual ~RealTypeDescriptor() { }
SDAI_Integer PrecisionSpec() {
SDAI_Integer PrecisionSpec() {
return _precisionSpec;
}
void PrecisionSpec( SDAI_Integer ps ) {
void PrecisionSpec( SDAI_Integer ps ) {
_precisionSpec = ps;
}
};

View file

@ -304,7 +304,7 @@ bool TypeDescriptor::AltName( const char * nm ) const {
if( altNames ) {
return ( altNames->choice( nm ) );
}
return 0;
return false;
}
/**
@ -404,10 +404,6 @@ Logical AttrDescriptor::Deriving() const {
return LFalse;
}
///////////////////////////////////////////////////////////////////////////////
// Derived_attribute functions
///////////////////////////////////////////////////////////////////////////////
Derived_attribute::Derived_attribute( const char * name, const TypeDescriptor * domainType,
Logical optional, Logical unique, AttrType_Enum at, const EntityDescriptor & owner )
: AttrDescriptor( name, domainType, optional, unique, at, owner ) {

View file

@ -7,6 +7,14 @@ core classes use a common set of virtual functions for reading and
writing to exchange files, reading and writing user interface formats,
and validating their data.
This directory also contains the InstMgr class and the classes which
help implement it. These were moved into core from the editor library
in order to break a cyclic dependency. InstMgr is used in the public
methods of both the core and editor libraries. Until it is known for
certain that no code passes InstMgr objects between the methods of
the two libraries, it will not be safe to simply remove usages from
either library in order to break the interdependency.
Directory Contents:
sdaiEnum.cc, sdaiEnum.h
@ -76,3 +84,27 @@ This file is basically a bunch of #include statements for all of the
header files corresponding to the specifications in Annex D of Part 22
(the proposaed SDAI/C++ language binding). Defines STEPentity, the
abstract base class of all generated entity classes.
from cleditor:
dispnode.cc, dispnode.h
Defines DisplayNode, a class encapsulating all display information for
an entity.
dispnodelist.cc, dispnodelist.h
Implements list operations for DisplayNode objects.
instmgr.cc, instmgr.h
Defines InstMgr, a class that keeps a master list of instances in the
current editing session.
mgrnode.cc, mgrnode.h
Defines the class MgrNode, used to represent a STEPentity along with
its state information and its display information. By associating a
STEPentity with a DisplayNode, this class hides the implementation of
an application's user interface from the application model.
mgrnodearray.cc, mgrnodearray.h
Implements array operations for MgrNode objects.
mgrnodelist.cc, mgrnodelist.h
Implements list operations for MgrNode objects.

View file

@ -33,9 +33,9 @@ class SCL_CORE_EXPORT Registry {
int entity_cnt,
all_ents_cnt;
HashEntry cur_entity;
HashEntry cur_schema;
HashEntry cur_type;
HashEntry cur_entity;
HashEntry cur_schema;
HashEntry cur_type;
// used by AddEntity() and RemoveEntity() to deal with renamings of an
// entity done in a USE or REFERENCE clause - see header comments in

View file

@ -21,10 +21,8 @@
const int Real_Num_Precision = REAL_NUM_PRECISION; // from STEPattribute.h
#define STRING_DELIM '\''
/******************************************************************//**
/******************************************************************************
** \file STEPaggregate.cc Functions for manipulating aggregate attributes
** FIXME KNOWN BUGs:
** -- treatment of aggregates of reals or ints is inconsistent with
@ -59,9 +57,9 @@ STEPaggregate & STEPaggregate::ShallowCopy( const STEPaggregate & a ) {
/// do not require exchange file format
Severity STEPaggregate::AggrValidLevel( const char * value, ErrorDescriptor * err,
const TypeDescriptor * elem_type, InstMgr * insts,
int optional, char * tokenList, int addFileId,
int clearError ) {
const TypeDescriptor * elem_type, InstMgr * insts,
int optional, char * tokenList, int addFileId,
int clearError ) {
std::string buf;
if( clearError ) {
err->ClearErrorMsg();
@ -79,9 +77,9 @@ Severity STEPaggregate::AggrValidLevel( const char * value, ErrorDescriptor * er
/// require exchange file format
Severity STEPaggregate::AggrValidLevel( istream & in, ErrorDescriptor * err,
const TypeDescriptor * elem_type, InstMgr * insts,
int optional, char * tokenList, int addFileId,
int clearError ) {
const TypeDescriptor * elem_type, InstMgr * insts,
int optional, char * tokenList, int addFileId,
int clearError ) {
std::string buf;
if( clearError ) {
err->ClearErrorMsg();
@ -98,9 +96,9 @@ Severity STEPaggregate::AggrValidLevel( istream & in, ErrorDescriptor * err,
/// if exchangeFileFormat == 1 then paren delims are required.
Severity STEPaggregate::ReadValue( istream & in, ErrorDescriptor * err,
const TypeDescriptor * elem_type, InstMgr * insts,
int addFileId, int assignVal, int exchangeFileFormat,
const char * ) {
const TypeDescriptor * elem_type, InstMgr * insts,
int addFileId, int assignVal, int exchangeFileFormat,
const char * ) {
ErrorDescriptor errdesc;
char errmsg[BUFSIZ];
int value_cnt = 0;
@ -201,8 +199,8 @@ Severity STEPaggregate::ReadValue( istream & in, ErrorDescriptor * err,
}
Severity STEPaggregate::StrToVal( const char * s, ErrorDescriptor * err,
const TypeDescriptor * elem_type, InstMgr * insts,
int addFileId ) {
const TypeDescriptor * elem_type, InstMgr * insts,
int addFileId ) {
istringstream in( ( char * )s );
return ReadValue( in, err, elem_type, insts, addFileId, 1, 0 );
}
@ -210,8 +208,8 @@ Severity STEPaggregate::StrToVal( const char * s, ErrorDescriptor * err,
///////////////////////////////////////////////////////////////////////////////
Severity STEPaggregate::STEPread( istream & in, ErrorDescriptor * err,
const TypeDescriptor * elem_type, InstMgr * insts,
int addFileId, const char * currSch ) {
const TypeDescriptor * elem_type, InstMgr * insts,
int addFileId, const char * currSch ) {
return ReadValue( in, err, elem_type, insts, addFileId, 1, 1, currSch );
}
@ -224,7 +222,8 @@ const char * STEPaggregate::asStr( std::string & s ) const {
std::string tmp;
while( n ) {
s.append( n->STEPwrite( tmp ) );
if( ( n = ( STEPnode * ) n -> NextNode() ) ) {
n = ( STEPnode * ) n -> NextNode();
if( n ) {
s.append( "," );
}
}
@ -240,7 +239,8 @@ void STEPaggregate::STEPwrite( ostream & out, const char * currSch ) const {
std::string s;
while( n ) {
out << n->STEPwrite( s, currSch );
if( ( n = ( STEPnode * )( n -> NextNode() ) ) ) {
n = ( STEPnode * ) n -> NextNode();
if( n ) {
out << ',';
}
}
@ -414,8 +414,7 @@ GenericAggrNode::GenericAggrNode() {
GenericAggrNode::~GenericAggrNode() {
}
SingleLinkNode *
GenericAggrNode::NewNode() {
SingleLinkNode * GenericAggrNode::NewNode() {
return new GenericAggrNode();
}
@ -447,8 +446,7 @@ const char * GenericAggrNode::STEPwrite( std::string & s, const char * currSch )
return value.STEPwrite( s );
}
void
GenericAggrNode::STEPwrite( ostream & out ) {
void GenericAggrNode::STEPwrite( ostream & out ) {
value.STEPwrite( out );
}
@ -465,9 +463,9 @@ EntityAggregate::~EntityAggregate() {
/// if exchangeFileFormat == 1 then delims are required.
Severity EntityAggregate::ReadValue( istream & in, ErrorDescriptor * err,
const TypeDescriptor * elem_type, InstMgr * insts,
int addFileId, int assignVal,
int exchangeFileFormat, const char * ) {
const TypeDescriptor * elem_type, InstMgr * insts,
int addFileId, int assignVal,
int exchangeFileFormat, const char * ) {
ErrorDescriptor errdesc;
char errmsg[BUFSIZ];
int value_cnt = 0;
@ -478,6 +476,7 @@ Severity EntityAggregate::ReadValue( istream & in, ErrorDescriptor * err,
}
char c;
int validDelims = 1;
in >> ws; // skip white space
@ -491,6 +490,7 @@ Severity EntityAggregate::ReadValue( istream & in, ErrorDescriptor * err,
if( c == '(' ) {
in.get( c );
validDelims = 0; // signal expectation for end delim
} else if( exchangeFileFormat ) {
// error did not find opening delim
// give up because you do not know where to stop reading.
@ -597,7 +597,7 @@ EntityNode::EntityNode() {
EntityNode::~EntityNode() {
}
EntityNode::EntityNode( SDAI_Application_instance * e ) : node( e ) {
EntityNode::EntityNode( SDAI_Application_instance * e ) : node( e ) {
}
SingleLinkNode * EntityNode::NewNode() {
@ -606,10 +606,10 @@ SingleLinkNode * EntityNode::NewNode() {
///////////////////////////////////////////////////////////////////////////////
Severity EntityNode::StrToVal( const char * s, ErrorDescriptor * err,
const TypeDescriptor * elem_type,
InstMgr * insts, int addFileId ) {
SDAI_Application_instance * se = ReadEntityRef( s, err, ",)", insts,
addFileId );
const TypeDescriptor * elem_type,
InstMgr * insts, int addFileId ) {
SDAI_Application_instance *se = ReadEntityRef( s, err, ",)", insts,
addFileId );
if( se != S_ENTITY_NULL ) {
ErrorDescriptor error;
if( EntityValidLevel( se, elem_type, &error ) == SEVERITY_NULL ) {
@ -627,23 +627,23 @@ Severity EntityNode::StrToVal( const char * s, ErrorDescriptor * err,
}
Severity EntityNode::StrToVal( istream & in, ErrorDescriptor * err,
const TypeDescriptor * elem_type,
InstMgr * insts, int addFileId ) {
const TypeDescriptor * elem_type,
InstMgr * insts, int addFileId ) {
return STEPread( in, err, elem_type, insts, addFileId );
}
Severity EntityNode::STEPread( const char * s, ErrorDescriptor * err,
const TypeDescriptor * elem_type,
InstMgr * insts, int addFileId ) {
const TypeDescriptor * elem_type,
InstMgr * insts, int addFileId ) {
istringstream in( ( char * )s );
return STEPread( in, err, elem_type, insts, addFileId );
}
Severity EntityNode::STEPread( istream & in, ErrorDescriptor * err,
const TypeDescriptor * elem_type,
InstMgr * insts, int addFileId ) {
SDAI_Application_instance * se = ReadEntityRef( in, err, ",)", insts,
addFileId );
const TypeDescriptor * elem_type,
InstMgr * insts, int addFileId ) {
SDAI_Application_instance *se = ReadEntityRef( in, err, ",)", insts,
addFileId );
if( se != S_ENTITY_NULL ) {
ErrorDescriptor error;
if( EntityValidLevel( se, elem_type, &error ) == SEVERITY_NULL ) {
@ -703,9 +703,9 @@ SelectAggregate::~SelectAggregate() {
/// if exchangeFileFormat == 1 then delims are required.
Severity SelectAggregate::ReadValue( istream & in, ErrorDescriptor * err,
const TypeDescriptor * elem_type, InstMgr * insts,
int addFileId, int assignVal,
int exchangeFileFormat, const char * currSch ) {
const TypeDescriptor * elem_type, InstMgr * insts,
int addFileId, int assignVal,
int exchangeFileFormat, const char * currSch ) {
ErrorDescriptor errdesc;
char errmsg[BUFSIZ];
int value_cnt = 0;
@ -716,6 +716,7 @@ Severity SelectAggregate::ReadValue( istream & in, ErrorDescriptor * err,
}
char c;
int validDelims = 1;
in >> ws; // skip white space
@ -729,6 +730,7 @@ Severity SelectAggregate::ReadValue( istream & in, ErrorDescriptor * err,
if( c == '(' ) {
in.get( c );
validDelims = 0; // signal expectation for end delim
} else if( exchangeFileFormat ) {
// error did not find opening delim
// give up because you do not know where to stop reading.
@ -830,7 +832,7 @@ SingleLinkNode * SelectAggregate::NewNode() {
// SelectNode
///////////////////////////////////////////////////////////////////////////////
SelectNode::SelectNode( SDAI_Select * s ) : node( s ) {
SelectNode::SelectNode( SDAI_Select * s ) : node( s ) {
}
SelectNode::SelectNode() {
@ -846,8 +848,8 @@ SingleLinkNode * SelectNode::NewNode() {
///////////////////////////////////////////////////////////////////////////////
Severity SelectNode::StrToVal( const char * s, ErrorDescriptor * err,
const TypeDescriptor * elem_type,
InstMgr * insts, int addFileId ) {
const TypeDescriptor * elem_type,
InstMgr * insts, int addFileId ) {
istringstream in( ( char * )s );
if( err->severity( node->STEPread( in, err, insts ) ) != SEVERITY_NULL ) {
err->AppendToDetailMsg( node ->Error() );
@ -856,21 +858,21 @@ Severity SelectNode::StrToVal( const char * s, ErrorDescriptor * err,
}
Severity SelectNode::StrToVal( istream & in, ErrorDescriptor * err,
const TypeDescriptor * elem_type,
InstMgr * insts, int addFileId, const char * currSch ) {
const TypeDescriptor * elem_type,
InstMgr * insts, int addFileId, const char * currSch ) {
return STEPread( in, err, elem_type, insts, addFileId, currSch );
}
Severity SelectNode::STEPread( const char * s, ErrorDescriptor * err,
const TypeDescriptor * elem_type,
InstMgr * insts, int addFileId ) {
const TypeDescriptor * elem_type,
InstMgr * insts, int addFileId ) {
istringstream in( ( char * )s );
return STEPread( in, err, elem_type, insts, addFileId );
}
Severity SelectNode::STEPread( istream & in, ErrorDescriptor * err,
const TypeDescriptor * elem_type,
InstMgr * insts, int addFileId, const char * currSch ) {
const TypeDescriptor * elem_type,
InstMgr * insts, int addFileId, const char * currSch ) {
if( !node ) {
cerr << "Internal error: " << __FILE__ << ": " << __LINE__ << "\n"
<< _POC_ "\n";
@ -968,11 +970,10 @@ SingleLinkNode * StringNode::NewNode() {
return new StringNode();
}
///////////////////////////////////////////////////////////////////////////////
// non-whitespace chars following s are considered garbage and is an error.
// a valid value will still be assigned if it exists before the garbage.
///////////////////////////////////////////////////////////////////////////////
/**
* non-whitespace chars following s are considered garbage and is an error.
* a valid value will still be assigned if it exists before the garbage.
*/
Severity StringNode::StrToVal( const char * s, ErrorDescriptor * err ) {
return STEPread( s, err );
}
@ -985,9 +986,9 @@ Severity StringNode::StrToVal( istream & in, ErrorDescriptor * err ) {
}
/**
** non-whitespace chars following s are considered garbage and is an error.
** a valid value will still be assigned if it exists before the garbage.
*/
* non-whitespace chars following s are considered garbage and is an error.
* a valid value will still be assigned if it exists before the garbage.
*/
Severity StringNode::STEPread( const char * s, ErrorDescriptor * err ) {
istringstream in( ( char * )s );
@ -1005,7 +1006,7 @@ Severity StringNode::STEPread( istream & in, ErrorDescriptor * err ) {
const char * StringNode::asStr( std::string & s ) {
value.asStr( s );
return s.c_str();
return const_cast<char *>( s.c_str() );
}
const char * StringNode::STEPwrite( std::string & s, const char * ) {
@ -1070,15 +1071,15 @@ BinaryNode::BinaryNode( const char * sStr ) {
value = sStr;
}
SingleLinkNode * BinaryNode::NewNode() {
SingleLinkNode *
BinaryNode::NewNode() {
return new BinaryNode();
}
///////////////////////////////////////////////////////////////////////////////
// non-whitespace chars following s are considered garbage and is an error.
// a valid value will still be assigned if it exists before the garbage.
///////////////////////////////////////////////////////////////////////////////
/**
* non-whitespace chars following s are considered garbage and is an error.
* a valid value will still be assigned if it exists before the garbage.
*/
Severity BinaryNode::StrToVal( const char * s, ErrorDescriptor * err ) {
return STEPread( s, err );
}
@ -1155,7 +1156,7 @@ EnumAggregate::~EnumAggregate() {
}
/****************************************************************//**
/******************************************************************
** \returns a new EnumNode which is of the correct derived type
** \details creates a node to put in an list of enumerated values
** function is virtual so that the right node will be
@ -1174,7 +1175,7 @@ SingleLinkNode * EnumAggregate::NewNode() {
// EnumNode
///////////////////////////////////////////////////////////////////////////////
EnumNode::EnumNode( SDAI_Enum * e ) : node( e ) {
EnumNode::EnumNode( SDAI_Enum * e ) : node( e ) {
}
EnumNode::EnumNode() {
@ -1252,7 +1253,7 @@ LOGICALS::~LOGICALS() {
}
SingleLinkNode * LOGICALS::NewNode() {
return new EnumNode( new SDAI_LOGICAL );
return new EnumNode( new SDAI_LOGICAL );
}
LOGICALS * create_LOGICALS() {

View file

@ -14,8 +14,6 @@
class InstMgr;
class STEPaggregate;
class LOGICAL;
class BOOLEAN;
class TypeDescriptor;
#include <scl_export.h>
@ -26,7 +24,7 @@ class TypeDescriptor;
#include <STEPundefined.h>
#include <string>
#define AGGR_NULL &NilSTEPaggregate
#define AGGR_NULL &NilSTEPaggregate
extern STEPaggregate NilSTEPaggregate;
class SingleLinkNode;
@ -34,6 +32,8 @@ class SingleLinkNode;
typedef STEPaggregate * STEPaggregateH;
typedef STEPaggregate * STEPaggregate_ptr;
typedef const STEPaggregate * const_STEPaggregateH;
typedef const STEPaggregate * const_STEPaggregate_ptr;
typedef STEPaggregate_ptr STEPaggregate_var;
class SCL_CORE_EXPORT STEPaggregate : public SingleLinkList {
@ -101,6 +101,8 @@ class SCL_CORE_EXPORT GenericAggregate : public STEPaggregate {
};
typedef GenericAggregate * GenericAggregateH;
typedef GenericAggregate * GenericAggregate_ptr;
typedef const GenericAggregate * const_GenericAggregateH;
typedef const GenericAggregate * const_GenericAggregate_ptr;
typedef GenericAggregate_ptr GenericAggregate_var;
/******************************************************************************
@ -123,6 +125,8 @@ class SCL_CORE_EXPORT EntityAggregate : public STEPaggregate {
};
typedef EntityAggregate * EntityAggregateH;
typedef EntityAggregate * EntityAggregate_ptr;
typedef const EntityAggregate * const_EntityAggregateH;
typedef const EntityAggregate * const_EntityAggregate_ptr;
typedef EntityAggregate_ptr EntityAggregate_var;
/****************************************************************//**
@ -145,6 +149,8 @@ class SCL_CORE_EXPORT SelectAggregate : public STEPaggregate {
};
typedef SelectAggregate * SelectAggregateH;
typedef SelectAggregate * SelectAggregate_ptr;
typedef const SelectAggregate * const_SelectAggregateH;
typedef const SelectAggregate * const_SelectAggregate_ptr;
typedef SelectAggregate_ptr SelectAggregate_var;
/****************************************************************//**
@ -161,6 +167,8 @@ class SCL_CORE_EXPORT StringAggregate : public STEPaggregate {
};
typedef StringAggregate * StringAggregateH;
typedef StringAggregate * StringAggregate_ptr;
typedef const StringAggregate * const_StringAggregateH;
typedef const StringAggregate * const_StringAggregate_ptr;
typedef StringAggregate_ptr StringAggregate_var;
@ -175,10 +183,11 @@ class SCL_CORE_EXPORT BinaryAggregate : public STEPaggregate {
BinaryAggregate();
virtual ~BinaryAggregate();
};
typedef BinaryAggregate * BinaryAggregateH;
typedef BinaryAggregate * BinaryAggregate_ptr;
typedef const BinaryAggregate * const_BinaryAggregateH;
typedef const BinaryAggregate * const_BinaryAggregate_ptr;
typedef BinaryAggregate_ptr BinaryAggregate_var;
/**************************************************************//**
@ -195,6 +204,8 @@ class SCL_CORE_EXPORT EnumAggregate : public STEPaggregate {
};
typedef EnumAggregate * EnumAggregateH;
typedef EnumAggregate * EnumAggregate_ptr;
typedef const EnumAggregate * const_EnumAggregateH;
typedef const EnumAggregate * const_EnumAggregate_ptr;
typedef EnumAggregate_ptr EnumAggregate_var;
class SCL_CORE_EXPORT LOGICALS : public EnumAggregate {
@ -206,6 +217,8 @@ class SCL_CORE_EXPORT LOGICALS : public EnumAggregate {
};
typedef LOGICALS * LogicalsH;
typedef LOGICALS * LOGICALS_ptr;
typedef const LOGICALS * const_LogicalsH;
typedef const LOGICALS * const_LOGICALS_ptr;
typedef LOGICALS_ptr LOGICALS_var;
SCL_CORE_EXPORT LOGICALS * create_LOGICALS();
@ -219,6 +232,7 @@ class SCL_CORE_EXPORT BOOLEANS : public EnumAggregate {
};
typedef BOOLEANS * BOOLEANS_ptr;
typedef const BOOLEANS * const_BOOLEANS_ptr;
typedef BOOLEANS_ptr BOOLEANS_var;
SCL_CORE_EXPORT BOOLEANS * create_BOOLEANS();
@ -234,6 +248,8 @@ class SCL_CORE_EXPORT RealAggregate : public STEPaggregate {
};
typedef RealAggregate * RealAggregateH;
typedef RealAggregate * RealAggregate_ptr;
typedef const RealAggregate * const_RealAggregateH;
typedef const RealAggregate * const_RealAggregate_ptr;
typedef RealAggregate_ptr RealAggregate_var;
class SCL_CORE_EXPORT IntAggregate : public STEPaggregate {
@ -247,6 +263,8 @@ class SCL_CORE_EXPORT IntAggregate : public STEPaggregate {
};
typedef IntAggregate * IntAggregateH;
typedef IntAggregate * IntAggregate_ptr;
typedef const IntAggregate * const_IntAggregateH;
typedef const IntAggregate * const_IntAggregate_ptr;
typedef IntAggregate_ptr IntAggregate_var;
///////////////////////////////////////////////////////////////////////////////
@ -263,41 +281,41 @@ class SCL_CORE_EXPORT STEPnode : public SingleLinkNode {
_null = 1;
}
// INPUT
// INPUT
virtual Severity StrToVal( const char * s, ErrorDescriptor * err );
virtual Severity StrToVal( istream & in, ErrorDescriptor * err );
virtual Severity STEPread( const char * s, ErrorDescriptor * err );
virtual Severity STEPread( istream & in, ErrorDescriptor * err );
// OUTPUT
// OUTPUT
virtual const char * asStr( std::string & s );
virtual const char * STEPwrite( std::string & s, const char * = 0 );
virtual void STEPwrite( ostream & out = cout );
};
typedef STEPnode * STEPnodeH;
/**************************************************************//**
** \class GenericAggregate
** This class is for the Nodes of GenericAggregates
******************************************************************/
typedef STEPnode * STEPnodeH;
typedef const STEPnode * const_STEPnodeH;
class SCL_CORE_EXPORT GenericAggrNode : public STEPnode {
public:
SCLundefined value;
// INPUT
// INPUT
virtual Severity StrToVal( const char * s, ErrorDescriptor * err );
virtual Severity StrToVal( istream & in, ErrorDescriptor * err );
virtual Severity STEPread( const char * s, ErrorDescriptor * err );
virtual Severity STEPread( istream & in, ErrorDescriptor * err );
// OUTPUT
// OUTPUT
virtual const char * asStr( std::string & s );
virtual const char * STEPwrite( std::string & s, const char * = 0 );
virtual void STEPwrite( ostream & out = cout );
virtual void STEPwrite( ostream & out = cout );
// CONSTRUCTORS
// CONSTRUCTORS
GenericAggrNode( const char * str );
GenericAggrNode( GenericAggrNode & gan );
GenericAggrNode();
@ -310,7 +328,7 @@ class SCL_CORE_EXPORT GenericAggrNode : public STEPnode {
class SCL_CORE_EXPORT EntityNode : public STEPnode {
public:
SDAI_Application_instance * node;
SDAI_Application_instance * node;
// INPUT
virtual Severity StrToVal( const char * s, ErrorDescriptor * err,
@ -326,13 +344,13 @@ class SCL_CORE_EXPORT EntityNode : public STEPnode {
virtual Severity STEPread( istream & in, ErrorDescriptor * err,
const TypeDescriptor * elem_type,
InstMgr * insts, int addFileId = 0 );
// OUTPUT
// OUTPUT
virtual const char * asStr( std::string & s );
virtual const char * STEPwrite( std::string & s, const char * = 0 );
virtual void STEPwrite( ostream & out = cout );
virtual void STEPwrite( ostream & out = cout );
// CONSTRUCTORS
EntityNode( SDAI_Application_instance * e );
// CONSTRUCTORS
EntityNode( SDAI_Application_instance * e );
EntityNode();
~EntityNode();
@ -370,8 +388,8 @@ class SCL_CORE_EXPORT EntityNode : public STEPnode {
******************************************************************/
class SCL_CORE_EXPORT SelectNode : public STEPnode {
public:
SDAI_Select * node;
// INPUT
SDAI_Select * node;
// INPUT
virtual Severity StrToVal( const char * s, ErrorDescriptor * err,
const TypeDescriptor * elem_type,
InstMgr * insts, int addFileId = 0 );
@ -387,13 +405,13 @@ class SCL_CORE_EXPORT SelectNode : public STEPnode {
const TypeDescriptor * elem_type,
InstMgr * insts, int addFileId = 0,
const char * currSch = 0 );
// OUTPUT
// OUTPUT
virtual const char * asStr( std::string & s );
virtual const char * STEPwrite( std::string & s, const char * = 0 );
virtual void STEPwrite( ostream & out = cout );
virtual void STEPwrite( ostream & out = cout );
// CONSTRUCTORS
SelectNode( SDAI_Select * s );
// CONSTRUCTORS
SelectNode( SDAI_Select * s );
SelectNode();
~SelectNode();
@ -429,20 +447,20 @@ class SCL_CORE_EXPORT SelectNode : public STEPnode {
******************************************************************/
class SCL_CORE_EXPORT StringNode : public STEPnode {
public:
SDAI_String value;
// INPUT
SDAI_String value;
// INPUT
virtual Severity StrToVal( const char * s, ErrorDescriptor * err );
virtual Severity StrToVal( istream & in, ErrorDescriptor * err );
virtual Severity STEPread( const char * s, ErrorDescriptor * err );
virtual Severity STEPread( istream & in, ErrorDescriptor * err );
// OUTPUT
// OUTPUT
virtual const char * asStr( std::string & s );
virtual const char * STEPwrite( std::string & s, const char * = 0 );
virtual void STEPwrite( ostream & out = cout );
virtual void STEPwrite( ostream & out = cout );
// CONSTRUCTORS
// CONSTRUCTORS
StringNode( StringNode & sn );
StringNode( const char * sStr );
StringNode();
@ -459,20 +477,20 @@ class SCL_CORE_EXPORT StringNode : public STEPnode {
******************************************************************/
class SCL_CORE_EXPORT BinaryNode : public STEPnode {
public:
SDAI_Binary value;
// INPUT
SDAI_Binary value;
// INPUT
virtual Severity StrToVal( const char * s, ErrorDescriptor * err );
virtual Severity StrToVal( istream & in, ErrorDescriptor * err );
virtual Severity STEPread( const char * s, ErrorDescriptor * err );
virtual Severity STEPread( istream & in, ErrorDescriptor * err );
// OUTPUT
// OUTPUT
virtual const char * asStr( std::string & s );
virtual const char * STEPwrite( std::string & s, const char * = 0 );
virtual void STEPwrite( ostream & out = cout );
virtual void STEPwrite( ostream & out = cout );
// CONSTRUCTORS
// CONSTRUCTORS
BinaryNode( BinaryNode & bn );
BinaryNode( const char * sStr );
BinaryNode();
@ -487,21 +505,21 @@ class SCL_CORE_EXPORT BinaryNode : public STEPnode {
******************************************************************/
class SCL_CORE_EXPORT EnumNode : public STEPnode {
public:
SDAI_Enum * node;
// INPUT
SDAI_Enum * node;
// INPUT
virtual Severity StrToVal( const char * s, ErrorDescriptor * err );
virtual Severity StrToVal( istream & in, ErrorDescriptor * err );
virtual Severity STEPread( const char * s, ErrorDescriptor * err );
virtual Severity STEPread( istream & in, ErrorDescriptor * err );
// OUTPUT
// OUTPUT
virtual const char * asStr( std::string & s );
virtual const char * STEPwrite( std::string & s, const char * = 0 );
virtual void STEPwrite( ostream & out = cout );
virtual void STEPwrite( ostream & out = cout );
// CONSTRUCTORS
EnumNode( SDAI_Enum * e );
// CONSTRUCTORS
EnumNode( SDAI_Enum * e );
EnumNode();
~EnumNode();
@ -510,20 +528,20 @@ class SCL_CORE_EXPORT EnumNode : public STEPnode {
class SCL_CORE_EXPORT RealNode : public STEPnode {
public:
SDAI_Real value; // double
// INPUT
SDAI_Real value; // double
// INPUT
virtual Severity StrToVal( const char * s, ErrorDescriptor * err );
virtual Severity StrToVal( istream & in, ErrorDescriptor * err );
virtual Severity STEPread( const char * s, ErrorDescriptor * err );
virtual Severity STEPread( istream & in, ErrorDescriptor * err );
// OUTPUT
// OUTPUT
virtual const char * asStr( std::string & s );
virtual const char * STEPwrite( std::string & s, const char * = 0 );
virtual void STEPwrite( ostream & out = cout );
virtual void STEPwrite( ostream & out = cout );
// CONSTRUCTORS
// CONSTRUCTORS
RealNode();
~RealNode();
@ -532,20 +550,20 @@ class SCL_CORE_EXPORT RealNode : public STEPnode {
class SCL_CORE_EXPORT IntNode : public STEPnode {
public:
SDAI_Integer value; // long int
// INPUT
SDAI_Integer value; // long int
// INPUT
virtual Severity StrToVal( const char * s, ErrorDescriptor * err );
virtual Severity StrToVal( istream & in, ErrorDescriptor * err );
virtual Severity STEPread( const char * s, ErrorDescriptor * err );
virtual Severity STEPread( istream & in, ErrorDescriptor * err );
// OUTPUT
// OUTPUT
virtual const char * asStr( std::string & s );
virtual const char * STEPwrite( std::string & s, const char * = 0 );
virtual void STEPwrite( ostream & out = cout );
virtual void STEPwrite( ostream & out = cout );
// CONSTRUCTORS
// CONSTRUCTORS
IntNode();
~IntNode();

View file

@ -9,6 +9,10 @@
* and is not subject to copyright.
*/
#include <iomanip>
#include <sstream>
#include <string>
#include <read_func.h>
#include <STEPattribute.h>
#include <instmgr.h>
@ -163,9 +167,7 @@ Severity STEPattribute::StrToVal( const char * s, InstMgr * instances, int addFi
}
break;
case UNKNOWN_TYPE: // should never have this case
std::cerr << "Error: unknown type in STEPattribute::StrToVal, " << __FILE__ << ":" << __LINE__ << std::endl;
abort();
// case UNKNOWN_TYPE: // should never have this case
case GENERIC_TYPE:
default:
// other cases are the same for StrToVal and file
@ -237,7 +239,7 @@ Severity STEPattribute::STEPread( istream & in, InstMgr * instances, int addFile
}
if( Nullable() ) {
_error.severity( SEVERITY_NULL );
} else if( !strict ) {
} else if ( !strict ) {
std::string fillerValue;
// we aren't in strict mode, so find out the type of the missing attribute and insert a suitable value.
ErrorDescriptor err; //this will be discarded
@ -259,7 +261,7 @@ Severity STEPattribute::STEPread( istream & in, InstMgr * instances, int addFile
}
case STRING_TYPE: {
fillerValue = "'',";
*( ptr.S ) = "''";
*(ptr.S) = "''";
break;
}
default: { //do not know what a good value would be for other types
@ -276,7 +278,7 @@ Severity STEPattribute::STEPread( istream & in, InstMgr * instances, int addFile
//create a warning. SEVERITY_WARNING makes more sense to me, but is considered more severe than SEVERITY_INCOMPLETE
_error.severity( SEVERITY_USERMSG );
_error.AppendToDetailMsg( " missing and required. For compatibility, replacing with " );
_error.AppendToDetailMsg( fillerValue.substr( 0, fillerValue.length() - 1 ) );
_error.AppendToDetailMsg( fillerValue.substr( 0, fillerValue.length()-1 ) );
_error.AppendToDetailMsg( ".\n" );
} else {
_error.severity( SEVERITY_INCOMPLETE );
@ -417,19 +419,16 @@ const char * STEPattribute::asStr( std::string & str, const char * currSch ) con
switch( NonRefType() ) {
case INTEGER_TYPE:
ss.clear();
ss << *( ptr.i );
str += ss.str();
// str += ( *( ptr.i ) );
break;
case NUMBER_TYPE:
case REAL_TYPE:
ss.clear();
ss.precision( ( int ) Real_Num_Precision );
ss << *( ptr.r );
str += ss.str();
// str.append( *( ptr.r ), ( int ) Real_Num_Precision );
break;
case ENTITY_TYPE:
@ -826,10 +825,7 @@ int STEPattribute::is_null() const {
** \return bool -- if false => not equal
******************************************************************/
bool operator == ( STEPattribute & a1, STEPattribute & a2 ) {
if( a1.aDesc == a2.aDesc ) {
return true;
}
return false;
return a1.aDesc == a2.aDesc;
}
@ -840,8 +836,7 @@ bool operator == ( STEPattribute & a1, STEPattribute & a2 ) {
* *note* for string values - (attrValue = 0) => string value does not exist,
* attrValue exists it is valid.
******************************************************************/
Severity STEPattribute::ValidLevel( const char * attrValue, ErrorDescriptor * error,
InstMgr * im, int clearError ) {
Severity STEPattribute::ValidLevel( const char * attrValue, ErrorDescriptor * error, InstMgr * im, int clearError ) {
if( clearError ) {
ClearErrorMsg();
}

View file

@ -1,5 +1,5 @@
#ifndef STEPATTRIBUTE_H
#define STEPATTRIBUTE_H 1
#define STEPATTRIBUTE_H 1
/*
* NIST STEP Core Class Library
@ -77,12 +77,13 @@ extern SCL_CORE_EXPORT void PushPastAggr1Dim( istream & in, std::string & s, Err
class SCL_CORE_EXPORT STEPattribute {
friend ostream & operator<< ( ostream &, STEPattribute & );
friend class SDAI_Application_instance;
protected:
public:
ErrorDescriptor _error;
unsigned int _derive : 1;
int Derive( unsigned int n = 1 ) {
return _derive = n;
}
STEPattribute * _redefAttr;
void RedefiningAttr( STEPattribute * a ) {
_redefAttr = a;
@ -136,27 +137,27 @@ class SCL_CORE_EXPORT STEPattribute {
////////////// Return info on attr
int Nullable() const; // may this attribute be null?
int is_null() const; // is this attribute null?
int IsDerived() const {
int Nullable() const; // may this attribute be null?
int is_null() const; // is this attribute null?
int IsDerived() const {
return _derive;
}
STEPattribute * RedefiningAttr() {
return _redefAttr;
}
const char * Name() const;
const char * TypeName() const;
const BASE_TYPE Type() const;
const BASE_TYPE NonRefType() const;
const BASE_TYPE BaseType() const;
const char * Name() const;
const char * TypeName() const;
BASE_TYPE Type() const;
BASE_TYPE NonRefType() const;
BASE_TYPE BaseType() const;
const TypeDescriptor * ReferentType() const;
const TypeDescriptor * ReferentType() const;
ErrorDescriptor & Error() {
ErrorDescriptor & Error() {
return _error;
}
void ClearErrorMsg() {
void ClearErrorMsg() {
_error.ClearErrorMsg();
}
@ -171,21 +172,21 @@ class SCL_CORE_EXPORT STEPattribute {
~STEPattribute() {};
// INTEGER
STEPattribute( const class AttrDescriptor & d, SDAI_Integer * p );
STEPattribute( const class AttrDescriptor & d, SDAI_Integer *p );
// BINARY
STEPattribute( const class AttrDescriptor & d, SDAI_Binary * p );
STEPattribute( const class AttrDescriptor & d, SDAI_Binary *p );
// STRING
STEPattribute( const class AttrDescriptor & d, SDAI_String * p );
STEPattribute( const class AttrDescriptor & d, SDAI_String *p );
// REAL & NUMBER
STEPattribute( const class AttrDescriptor & d, SDAI_Real * p );
STEPattribute( const class AttrDescriptor & d, SDAI_Real *p );
// ENTITY
STEPattribute( const class AttrDescriptor & d, SDAI_Application_instance* *p );
// AGGREGATE
STEPattribute( const class AttrDescriptor & d, STEPaggregate * p );
// ENUMERATION and Logical
STEPattribute( const class AttrDescriptor & d, SDAI_Enum * p );
STEPattribute( const class AttrDescriptor & d, SDAI_Enum *p );
// SELECT
STEPattribute( const class AttrDescriptor & d, SDAI_Select * p );
STEPattribute( const class AttrDescriptor & d, SDAI_Select *p );
// UNDEFINED
STEPattribute( const class AttrDescriptor & d, SCLundefined * p );

View file

@ -21,28 +21,28 @@ STEPattribute::STEPattribute( const STEPattribute & a )
: _derive( 0 ), _redefAttr( 0 ), aDesc( a.aDesc ), refCount( 0 ) {}
/// INTEGER
STEPattribute::STEPattribute( const class AttrDescriptor & d, SDAI_Integer * p )
STEPattribute::STEPattribute( const class AttrDescriptor & d, SDAI_Integer *p )
: _derive( 0 ), _redefAttr( 0 ), aDesc( &d ), refCount( 0 ) {
ptr.i = p;
assert( &d ); //ensure that the AttrDescriptor is not a null pointer
}
/// BINARY
STEPattribute::STEPattribute( const class AttrDescriptor & d, SDAI_Binary * p )
STEPattribute::STEPattribute( const class AttrDescriptor & d, SDAI_Binary *p )
: _derive( 0 ), _redefAttr( 0 ), aDesc( &d ), refCount( 0 ) {
ptr.b = p;
assert( &d ); //ensure that the AttrDescriptor is not a null pointer
}
/// STRING
STEPattribute::STEPattribute( const class AttrDescriptor & d, SDAI_String * p )
STEPattribute::STEPattribute( const class AttrDescriptor & d, SDAI_String *p )
: _derive( 0 ), _redefAttr( 0 ), aDesc( &d ), refCount( 0 ) {
ptr.S = p;
assert( &d ); //ensure that the AttrDescriptor is not a null pointer
}
/// REAL & NUMBER
STEPattribute::STEPattribute( const class AttrDescriptor & d, SDAI_Real * p )
STEPattribute::STEPattribute( const class AttrDescriptor & d, SDAI_Real *p )
: _derive( 0 ), _redefAttr( 0 ), aDesc( &d ), refCount( 0 ) {
ptr.r = p;
assert( &d ); //ensure that the AttrDescriptor is not a null pointer
@ -50,7 +50,7 @@ STEPattribute::STEPattribute( const class AttrDescriptor & d, SDAI_Real * p )
/// ENTITY
STEPattribute::STEPattribute( const class AttrDescriptor & d,
SDAI_Application_instance* *p )
SDAI_Application_instance * *p )
: _derive( 0 ), _redefAttr( 0 ), aDesc( &d ), refCount( 0 ) {
ptr.c = p;
assert( &d ); //ensure that the AttrDescriptor is not a null pointer
@ -64,7 +64,7 @@ STEPattribute::STEPattribute( const class AttrDescriptor & d, STEPaggregate * p
}
/// ENUMERATION and Logical
STEPattribute::STEPattribute( const class AttrDescriptor & d, SDAI_Enum * p )
STEPattribute::STEPattribute( const class AttrDescriptor & d, SDAI_Enum *p )
: _derive( 0 ), _redefAttr( 0 ), aDesc( &d ), refCount( 0 ) {
ptr.e = p;
assert( &d ); //ensure that the AttrDescriptor is not a null pointer
@ -72,7 +72,7 @@ STEPattribute::STEPattribute( const class AttrDescriptor & d, SDAI_Enum * p )
/// SELECT
STEPattribute::STEPattribute( const class AttrDescriptor & d,
class SDAI_Select * p )
class SDAI_Select *p )
: _derive( 0 ), _redefAttr( 0 ), aDesc( &d ), refCount( 0 ) {
ptr.sh = p;
assert( &d ); //ensure that the AttrDescriptor is not a null pointer
@ -98,19 +98,23 @@ const char * STEPattribute::TypeName() const {
return aDesc->TypeName();
}
const BASE_TYPE STEPattribute::Type() const {
BASE_TYPE STEPattribute::Type() const {
if( _redefAttr ) {
return _redefAttr->Type();
}
return aDesc->Type();
}
const BASE_TYPE STEPattribute::NonRefType() const {
return ( _redefAttr ? _redefAttr->NonRefType() :
( aDesc ? aDesc->NonRefType() : UNKNOWN_TYPE ) );
BASE_TYPE STEPattribute::NonRefType() const {
if( _redefAttr ) {
return _redefAttr->NonRefType();
} else if ( aDesc ) {
return aDesc->NonRefType();
}
return UNKNOWN_TYPE;
}
const BASE_TYPE STEPattribute::BaseType() const {
BASE_TYPE STEPattribute::BaseType() const {
if( _redefAttr ) {
return _redefAttr->BaseType();
}

View file

@ -41,10 +41,10 @@ STEPattribute & STEPattributeList::operator []( int n ) {
return *( a->attr );
}
// else
cerr << "\nERROR in STEP Core library: " << __FILE__ << ":"
<< __LINE__ << "\n" << _POC_ << "\n\n";
abort();
return *( STEPattribute * ) 0; //will never get here, but gcc produces warning
return *( STEPattribute * ) 0;
}
int STEPattributeList::list_length() {
@ -60,6 +60,7 @@ void STEPattributeList::push( STEPattribute * a ) {
while( a2 && push ) {
if( *a == *( a2 -> attr ) ) {
push = false;
break;
}
a2 = ( AttrListNode * )( a2->next );
}

View file

@ -42,16 +42,23 @@ class SCL_CORE_EXPORT STEPattributeList : public SingleLinkList {
void push( STEPattribute * a );
};
/*************************************************************//**
** \file STEPattributeList.h
** This file defines the type STEPattributeList -- a list
** of pointers to STEPattribute objects. The nodes on the
/*****************************************************************
** **
** This file defines the type STEPattributeList -- a list **
** of pointers to STEPattribute objects. The nodes on the **
** list point to STEPattributes.
**
** The file is dependent on the file "STEPattribute.h"
** which contains the definition of STEPattribute.
**
** 1/15/91 kcm
** **
USED TO BE - DAS
** The file was generated by using GNU's genclass.sh **
** script with the List prototype definitions. The **
** command to generate it was as follows: **
genclass.sh STEPattribute ref List STEPattribute
** The file is dependent on the file "STEPattribute.h" **
** which contains the definition of STEPattribute. **
** **
** 1/15/91 kcm **
*****************************************************************/
#endif

View file

@ -7,28 +7,23 @@
#include <sstream>
#include "scl_memmgr.h"
extern const char * ReadStdKeyword( istream & in, std::string & buf, int skipInitWS );
extern const char *
ReadStdKeyword( istream & in, std::string & buf, int skipInitWS );
STEPcomplex::STEPcomplex( Registry * registry, int fileid )
: SDAI_Application_instance( fileid, 1 ) {
sc = 0;
: SDAI_Application_instance ( fileid, 1 ), sc( 0 ), _registry( registry ), visited( 0 ) {
head = this;
_registry = registry;
visited = 0;
}
STEPcomplex::STEPcomplex( Registry * registry, const std::string ** names,
int fileid, const char * schnm )
: SDAI_Application_instance( fileid, 1 ) {
sc = 0;
head = this;
_registry = registry;
visited = 0;
: SDAI_Application_instance ( fileid, 1 ), sc( 0 ), _registry( registry ), visited( 0 ) {
char * nms[BUFSIZ];
int j, k;
head = this;
// Create a char ** list of names and call Initialize to build all:
for( j = 0; names[j]; j++ ) {
nms[j] = new char[( names[j] )->length() + 1 ];
@ -43,12 +38,9 @@ STEPcomplex::STEPcomplex( Registry * registry, const std::string ** names,
STEPcomplex::STEPcomplex( Registry * registry, const char ** names, int fileid,
const char * schnm )
: SDAI_Application_instance( fileid, 1 ) {
sc = 0;
head = this;
_registry = registry;
visited = 0;
: SDAI_Application_instance ( fileid, 1 ), sc( 0 ), _registry( registry ), visited( 0 ) {
head = this;
Initialize( names, schnm );
}
@ -69,7 +61,7 @@ void STEPcomplex::Initialize( const char ** names, const char * schnm ) {
*eptr = ents, *prev = NULL, *enext;
const EntityDescriptor * enDesc;
char nm[BUFSIZ];
bool invalid = false, outOfOrder = false;
int invalid = 0, outOfOrder = 0;
// Splice out the invalid names from our list:
while( eptr ) {
@ -88,11 +80,11 @@ void STEPcomplex::Initialize( const char ** names, const char * schnm ) {
// support structs only deal with the original names) and have
// ents re-ort eptr properly in the list:
eptr->Name( StrToLower( enDesc->Name(), nm ) );
outOfOrder = true;
outOfOrder = 1;
}
prev = eptr;
} else {
invalid = true;
invalid = 1;
cerr << "ERROR: Invalid entity \"" << eptr->Name()
<< "\" found in complex entity.\n";
if( !prev ) {
@ -259,6 +251,7 @@ int STEPcomplex::EntityExists( const char * name, const char * currSch ) {
*/
const EntityDescriptor * STEPcomplex::IsA( const EntityDescriptor * ed ) const {
const EntityDescriptor * return_ed = eDesc->IsA( ed );
if( !return_ed && sc ) {
return sc->IsA( ed );
} else {
@ -534,8 +527,9 @@ void STEPcomplex::BuildAttrs( const char * s ) {
break;
}
default:
cerr << "STEPcomplex::BuildAttrs: type " << ad->NonRefType() << " not handled by switch statement. " << __FILE__ << ":" << __LINE__ << endl;
abort();
_error.AppendToDetailMsg( "STEPcomplex::BuildAttrs: Found attribute of unknown type. Creating default attribute.\n" );
_error.GreaterSeverity( SEVERITY_WARNING );
a = new STEPattribute();
}
a -> set_null();

View file

@ -30,10 +30,10 @@ enum PrimitiveType {
sdaiNUMBER = 0x0400,
// The elements defined below are not part of part 23
// (IMS: these should not be used as bitmask fields)
ARRAY_TYPE, // DAS
BAG_TYPE, // DAS
SET_TYPE, // DAS
LIST_TYPE, // DAS
ARRAY_TYPE, // DAS
BAG_TYPE, // DAS
SET_TYPE, // DAS
LIST_TYPE, // DAS
GENERIC_TYPE,
REFERENCE_TYPE,
UNKNOWN_TYPE
@ -56,13 +56,13 @@ typedef PrimitiveType BASE_TYPE;
#define NUMBER_TYPE sdaiNUMBER
/* not defined in part 23
ARRAY_TYPE, // DAS
BAG_TYPE, // DAS
SET_TYPE, // DAS
LIST_TYPE, // DAS
GENERIC_TYPE,
REFERENCE_TYPE,
UNKNOWN_TYPE
ARRAY_TYPE, // DAS
BAG_TYPE, // DAS
SET_TYPE, // DAS
LIST_TYPE, // DAS
GENERIC_TYPE,
REFERENCE_TYPE,
UNKNOWN_TYPE
*/
#endif

View file

@ -118,12 +118,12 @@ class SCL_CORE_EXPORT EntNode {
bool marked( MarkType base = ORMARK ) {
return ( mark >= base );
}
bool allMarked(); ///< returns true if all nodes in list are marked
bool allMarked(); ///< returns true if all nodes in list are marked
int unmarkedCount();
bool multSuprs() {
return multSupers;
}
void multSuprs( bool j ) {
void multSuprs( int j ) {
multSupers = j;
}
void sort( EntNode ** );
@ -212,7 +212,8 @@ class SCL_CORE_EXPORT SimpleList : public EntList {
public:
SimpleList( const char * n ) : EntList( SIMPLE ), I_marked( NOMARK ) {
strcpy( name, n );
strncpy( name, n, sizeof( name ) - 1 );
name[sizeof( name ) - 1] = '\0'; /* sanity */
}
~SimpleList() {}
int operator== ( const char * nm ) {
@ -222,16 +223,10 @@ class SCL_CORE_EXPORT SimpleList : public EntList {
return name;
}
bool contains( char * nm ) {
if( *this == nm ) {
return true;
}
return false;
return *this == nm;
}
bool hit( char * nm ) {
if( *this == nm ) {
return true;
}
return false;
return *this == nm;
}
MatchType matchNonORs( EntNode * );
bool acceptChoice( EntNode * );
@ -271,12 +266,13 @@ class SCL_CORE_EXPORT MultList : public EntList {
int childCount() {
return numchildren;
}
// EntList *operator[]( int );
EntList * getChild( int );
EntList * getLast() {
return ( getChild( numchildren - 1 ) );
}
void unmarkAll( EntNode * );
bool prevKnown( EntList * desc );
bool prevKnown( EntList * );
void reset();
protected:
@ -300,7 +296,7 @@ class SCL_CORE_EXPORT JoinList : public MultList {
JoinList( JoinType j ) : MultList( j ) {}
~JoinList() {}
void setViableVal( EntNode * );
bool acceptChoice( EntNode * ents );
bool acceptChoice( EntNode * );
};
class SCL_CORE_EXPORT AndOrList : public JoinList {
@ -326,9 +322,9 @@ class SCL_CORE_EXPORT AndList : public JoinList {
class SCL_CORE_EXPORT OrList : public MultList {
public:
OrList() : MultList( OR ), choice( -1 ), choice1( -2 ), choiceCount( 0 ) {}
OrList() : MultList( OR ), choice( -1 ), choice1( -1 ), choiceCount( 0 ) {}
~OrList() {}
bool hit( char * nm );
bool hit( char * );
MatchType matchORs( EntNode * );
MatchType tryNext( EntNode * );
void unmarkAll( EntNode * );
@ -382,8 +378,8 @@ class SCL_CORE_EXPORT ComplexList {
* Based on knowledge that ComplexList always created by ANDing supertype
* with subtypes.
*/
bool toplevel( const char * name );
bool contains( EntNode * ents );
bool toplevel( const char * );
bool contains( EntNode * );
bool matches( EntNode * );
EntNode * list; /**< List of all entities contained in this complex type,
@ -398,7 +394,7 @@ class SCL_CORE_EXPORT ComplexList {
private:
void addChildren( EntList * );
bool hitMultNodes( EntNode * ents );
bool hitMultNodes( EntNode * );
int abstract; ///< is our supertype abstract?
int dependent; ///< is our supertype also a subtype of other supertype(s)?
bool multSupers; ///< am I a combo-CList created to test a subtype which has >1 supertypes?

View file

@ -165,7 +165,7 @@ bool ComplexList::contains( EntNode * ents ) {
*/
bool ComplexList::matches( EntNode * ents ) {
MatchType retval, otherChoices = NEWCHOICE;
bool result = false;
int result = false;
// First check if this ComplexList at least contains all the nodes of ents.
// If it does, we'll search in detail. If not, we're done.

View file

@ -0,0 +1,56 @@
/*
* NIST STEP Editor Class Library
* cleditor/dispnode.cc
* April 1997
* David Sauder
* K. C. Morris
* Development of this software was funded by the United States Government,
* and is not subject to copyright.
*/
/* $Id: dispnode.cc,v 3.0.1.2 1997/11/05 22:11:39 sauderd DP3.1 $ */
#include <gennode.h>
#include <gennodelist.h>
//#include <gennode.inline.h>
#include <dispnode.h>
#include <dispnodelist.h>
#include "scl_memmgr.h"
// define this to be the name of the display object
class StepEntityEditor;
// This function needs to be defined outside the SCL libraries. It needs to do
// two things:
// 1) unmap the StepEntityEditor window if it is mapped.
// 2) delete the StepEntityEditor window
// To see an example of this function used with the Data Probe look in
// ../clprobe-ui/StepEntEditor.cc Look at DeleteSEE() and ~StepEntityEditor().
extern void DeleteSEE( StepEntityEditor * se );
DisplayNode::~DisplayNode() {
Remove();
if( see ) {
DeleteSEE( ( StepEntityEditor * )see );
//DAS PORT need the cast from void* DeleteSEE(see);
}
}
void DisplayNode::Remove() {
GenericNode::Remove();
// DON'T DO THIS!! displayState = noMapState;
}
int DisplayNode::ChangeState( displayStateEnum s ) {
displayState = s;
return 1;
}
int DisplayNode::ChangeList( DisplayNodeList * cmdList ) {
Remove();
cmdList->Append( this );
return 1;
}

90
src/clstepcore/dispnode.h Normal file
View file

@ -0,0 +1,90 @@
#ifndef dispnode_h
#define dispnode_h
/*
* NIST STEP Editor Class Library
* cleditor/dispnode.h
* April 1997
* David Sauder
* K. C. Morris
* Development of this software was funded by the United States Government,
* and is not subject to copyright.
*/
/* $Id: dispnode.h,v 3.0.1.2 1997/11/05 22:11:39 sauderd DP3.1 $ */
#include <scl_export.h>
/*#include <STEPattribute.h>*/
/*#include <STEPentity.h>*/
#include <sdai.h>
#include <gennode.h>
#include <gennodelist.h>
//#include <gennode.inline.h>
#include <editordefines.h>
//#include <mgrnode.h>
class MgrNode;
//////////////////////////////////////////////////////////////////////////////
// class DisplayNode
//////////////////////////////////////////////////////////////////////////////
class SCL_CORE_EXPORT DisplayNode : public GenericNode {
protected:
friend class GenNodeList;
friend class DisplayNodeList;
MgrNode * mn;
void * see;
displayStateEnum displayState; // = { mappedWrite, mappedView, notMapped }
public:
// this should probably only be used to create head nodes for dispnodelists
DisplayNode() {
displayState = noMapState;
}
DisplayNode( MgrNode * node ) {
mn = node;
displayState = noMapState;
}
~DisplayNode();
void SEE( void * s ) {
see = s;
}
virtual void * SEE() {
return see;
};
void mgrNode( MgrNode * node ) {
mn = node;
}
class MgrNode * mgrNode() {
return mn;
}
displayStateEnum DisplayState() {
return displayState;
}
int DisplayListMember( displayStateEnum ds ) {
return ( displayState == ds );
}
int ChangeState( displayStateEnum s );
int ChangeList( DisplayNodeList * cmdList );
void Remove();
protected:
};
//////////////////////////////////////////////////////////////////////////////
// class DisplayNode inline functions
// these functions don't rely on any inline functions (its own or
// other classes) that aren't in this file except for Generic functions
//////////////////////////////////////////////////////////////////////////////
#endif

View file

@ -0,0 +1,56 @@
/*
* NIST STEP Editor Class Library
* cleditor/dispnodelist.cc
* April 1997
* David Sauder
* K. C. Morris
* Development of this software was funded by the United States Government,
* and is not subject to copyright.
*/
/* $Id: dispnodelist.cc,v 3.0.1.2 1997/11/05 22:11:40 sauderd DP3.1 $ */
#include <gennode.h>
#include <gennodelist.h>
#include <mgrnode.h>
#include <mgrnodelist.h>
#include <dispnode.h>
#include <dispnodelist.h>
#include "scl_memmgr.h"
void DisplayNodeList::Remove( GenericNode * node ) {
GenNodeList::Remove( node );
// DON'T DO THIS ((DisplayNode *)node)->displayState = noMapState;
}
// deletes node from its previous list & appends
// actually it puts it at the front of the list.
void DisplayNodeList::Append( GenericNode * node ) {
InsertBefore( node, head );
}
// deletes newNode from its previous list & inserts after
// existNode
void DisplayNodeList::InsertAfter( GenericNode * newNode,
GenericNode * existNode ) {
if( newNode->next != 0 ) { // remove the node from its previous
newNode->Remove(); // display state list
}
GenNodeList::InsertAfter( newNode, existNode );
// DON'T DO THIS ((DisplayNode *)newNode)->displayState = listType;
}
// deletes newNode from its previous list & inserts before
// existNode
void DisplayNodeList::InsertBefore( GenericNode * newNode,
GenericNode * existNode ) {
if( newNode->next != 0 ) { // remove the node from its previous
newNode->Remove(); // display state list
}
GenNodeList::InsertBefore( newNode, existNode );
// DON'T DO THIS!!! ((DisplayNode *)newNode)->displayState = listType;
}

View file

@ -0,0 +1,68 @@
#ifndef dispnodelist_h
#define dispnodelist_h
/*
* NIST STEP Editor Class Library
* cleditor/dispnodelist.h
* April 1997
* David Sauder
* K. C. Morris
* Development of this software was funded by the United States Government,
* and is not subject to copyright.
*/
/* $Id: dispnodelist.h,v 3.0.1.2 1997/11/05 22:11:40 sauderd DP3.1 $ */
#include <scl_export.h>
#include <gennode.h>
//#include <gennode.inline.h>
#include <editordefines.h>
#include <mgrnode.h>
#include <dispnode.h>
#include <gennodelist.h>
///////////////////////////////////////////////////////////////////////////////
// class DisplayNodeList
// This will be used to represent the display state lists.
//////////////////////////////////////////////////////////////////////////////
class SCL_CORE_EXPORT DisplayNodeList : public GenNodeList {
public:
DisplayNodeList( displayStateEnum type );
~DisplayNodeList() { }
// ADDED functions
displayStateEnum GetState() {
return listType;
}
// REDEFINED functions
// deletes node from its previous list & appends
virtual void Append( GenericNode * node );
// deletes newNode from its previous list & inserts in
// relation to existNode
virtual void InsertAfter( GenericNode * newNode, GenericNode * existNode );
virtual void InsertBefore( GenericNode * newNode, GenericNode * existNode );
virtual void Remove( GenericNode * node );
protected:
private:
displayStateEnum listType;
};
//////////////////////////////////////////////////////////////////////////////
// class DisplayNodeList inline functions
// these functions don't rely on any inline functions (its own or
// other classes) that aren't in this file except for Generic functions
//////////////////////////////////////////////////////////////////////////////
inline DisplayNodeList::DisplayNodeList( displayStateEnum type )
: GenNodeList( new DisplayNode() ) {
listType = type;
( ( DisplayNode * )head )->displayState = type;
}
#endif

413
src/clstepcore/instmgr.cc Normal file
View file

@ -0,0 +1,413 @@
/*
* NIST STEP Editor Class Library
* cleditor/instmgr.cc
* April 1997
* David Sauder
* K. C. Morris
* Development of this software was funded by the United States Government,
* and is not subject to copyright.
*/
//////////////////////////////////////////////////////////////////////////////
//
// InstMgr member functions
//
//////////////////////////////////////////////////////////////////////////////
#include <sdai.h>
#include <instmgr.h>
#include "scl_memmgr.h"
///////////////////////////////////////////////////////////////////////////////
// debug_level >= 2 => tells when a command is chosen
// debug_level >= 3 => prints values within functions:
///////////////////////////////////////////////////////////////////////////////
static int debug_level = 3;
// if debug_level is greater than this number then
// function names get printed out when executed
//static int PrintFunctionTrace = 2;
// if debug_level is greater than this number then
// values within functions get printed out
//static int PrintValues = 3;
///////////////////////////////////////////////////////////////////////////////
void
InstMgr::PrintSortedFileIds() {
MgrNode * mn = 0;
int count = InstanceCount();
int i = 0;
for( i = 0; i < count; i++ ) {
mn = ( MgrNode * )( ( *sortedMaster )[i] );
cout << i << " " << mn->GetFileId() << endl;
}
}
InstMgr::InstMgr( int ownsInstances )
: maxFileId( -1 ), _ownsInstances( ownsInstances ) {
master = new MgrNodeArray();
sortedMaster = new MgrNodeArraySorted();
}
InstMgr::~InstMgr() {
if( _ownsInstances ) {
master->DeleteEntries();
} else {
master->ClearEntries();
}
sortedMaster->ClearEntries();
delete master;
delete sortedMaster;
}
///////////////////////////////////////////////////////////////////////////////
void InstMgr::ClearInstances() {
master->ClearEntries();
sortedMaster->ClearEntries();
maxFileId = -1;
}
void InstMgr::DeleteInstances() {
master->DeleteEntries();
sortedMaster->ClearEntries();
maxFileId = -1;
}
///////////////////////////////////////////////////////////////////////////////
/**************************************************
description:
returns:
SEVERITY_NULL: if all instances are complete
SEVERITY_INCOMPLETE: if at least one instance is missing a required attribute
SEVERITY_WARNING:
SEVERITY_INPUT_ERROR: if at least one instance can not be fetched
from the instance list.
**************************************************/
enum Severity
InstMgr::VerifyInstances( ErrorDescriptor & err ) {
int errorCount = 0;
char errbuf[BUFSIZ];
int n = InstanceCount();
MgrNode * mn;
SDAI_Application_instance * se;
enum Severity rval = SEVERITY_NULL;
//for each instance on the list,
//check the MgrNode state.
//if the state is complete then do nothing
//if the state is not complete,
// then check if it is valid
// if it is valid then increment the warning count,
// and set the rval to SEVERITY_INCOMPLETE
// if it is not valid, then increment the error count
// and set the rval to
for( int i = 0; i < n; ++i ) {
mn = GetMgrNode( i );
if( !mn ) {
++errorCount;
if( errorCount == 1 )
sprintf( errbuf,
"VerifyInstances: Unable to verify the following instances: node %d",
i );
else {
sprintf( errbuf, ", node %d", i );
}
err.AppendToDetailMsg( errbuf );
rval = SEVERITY_INPUT_ERROR;
err.GreaterSeverity( SEVERITY_INPUT_ERROR );
continue;
}
if( debug_level > 3 )
cerr << "In VerifyInstances: "
<< "new MgrNode for " << mn->GetFileId() << " with state "
<< mn->CurrState() << endl;
if( !mn->MgrNodeListMember( completeSE ) ) {
se = mn->GetApplication_instance();
if( se->ValidLevel( &err, this, 0 ) < SEVERITY_USERMSG ) {
if( rval > SEVERITY_INCOMPLETE ) {
rval = SEVERITY_INCOMPLETE;
}
++errorCount;
if( errorCount == 1 )
sprintf( errbuf,
"VerifyInstances: Unable to verify the following instances: #%d",
se->StepFileId() );
else {
sprintf( errbuf, ", #%d", se->StepFileId() );
}
err.AppendToDetailMsg( errbuf );
}
}
}
if( errorCount ) {
sprintf( errbuf,
"VerifyInstances: %d invalid instances in list.\n",
errorCount );
err.AppendToUserMsg( errbuf );
err.AppendToDetailMsg( ".\n" );
err.GreaterSeverity( SEVERITY_INCOMPLETE );
}
return rval;
}
///////////////////////////////////////////////////////////////////////////////
MgrNode * InstMgr::FindFileId( int fileId ) {
int index = sortedMaster->MgrNodeIndex( fileId );
if( index >= 0 ) {
return ( MgrNode * )( *sortedMaster )[index];
} else {
return ( MgrNode * )0;
}
}
///////////////////////////////////////////////////////////////////////////////
// get the index into display list given a SDAI_Application_instance
// called by see initiated functions
int InstMgr::GetIndex( MgrNode * mn ) {
return mn->ArrayIndex();
}
///////////////////////////////////////////////////////////////////////////////
int InstMgr::GetIndex( SDAI_Application_instance * se ) {
int fileId = se->StepFileId();
return sortedMaster->MgrNodeIndex( fileId );
}
///////////////////////////////////////////////////////////////////////////////
int InstMgr::VerifyEntity( int fileId, const char * expectedType ) {
MgrNode * mn = FindFileId( fileId );
if( mn ) {
if( !strcmp( expectedType, mn->GetApplication_instance()->EntityName() ) ) {
return 2; // types match
} else {
return 1; // possible mismatch depending on descendants
}
} else {
return 0;
}
}
///////////////////////////////////////////////////////////////////////////////
// Append instance to the list of instances. Checks the file id and
// sets it if 1) it is not set already or 2) it already exists in the list.
MgrNode * InstMgr::Append( SDAI_Application_instance * se, stateEnum listState ) {
if( debug_level > 3 ) {
cout << "#" << se->StepFileId() << " append node to InstMgr" << endl;
}
MgrNode * mn = 0;
if( se->StepFileId() == 0 ) { // no id assigned
se->StepFileId( NextFileId() ); // assign a file id
}
mn = FindFileId( se->StepFileId() );
if( mn ) { // if id already in list
// and it's because instance is already in list
if( GetApplication_instance( mn ) == se ) {
return 0; // return 0 or mn?
} else {
se->StepFileId( NextFileId() ); // otherwise assign a new file id
}
}
// update the maxFileId if needed
if( se->StepFileId() > MaxFileId() ) {
maxFileId = se->StepFileId();
}
mn = new MgrNode( se, listState );
if( debug_level > 3 )
cerr << "new MgrNode for " << mn->GetFileId() << " with state "
<< mn->CurrState() << endl;
if( listState == noStateSE )
cout << "append to InstMgr **ERROR ** node #" << se->StepFileId() <<
" doesn't have state information" << endl;
master->Append( mn );
sortedMaster->Insert( mn );
//PrintSortedFileIds();
return mn;
}
///////////////////////////////////////////////////////////////////////////////
void InstMgr::Delete( MgrNode * node ) {
// delete the node from its current state list
node->Remove();
int index;
// get the index of the node in the sorted master array
index = sortedMaster->MgrNodeIndex( node->GetFileId() );
// remove the node from the sorted master array
sortedMaster->Remove( index );
// get the index into the master array by ptr arithmetic
index = node->ArrayIndex();
master->Remove( index );
delete node;
}
///////////////////////////////////////////////////////////////////////////////
void InstMgr::Delete( SDAI_Application_instance * se ) {
Delete( FindFileId( se->StepFileId() ) );
}
///////////////////////////////////////////////////////////////////////////////
void InstMgr::ChangeState( MgrNode * node, stateEnum listState ) {
switch( listState ) {
case completeSE:
if( debug_level > 3 )
cout << "#" << node->GetApplication_instance()->StepFileId() <<
" change node to InstMgr's complete list\n";
node->ChangeState( listState );
break;
case incompleteSE:
if( debug_level > 3 )
cout << "#" << node->GetApplication_instance()->StepFileId() <<
" change node to InstMgr's incomplete list\n";
node->ChangeState( listState );
break;
case newSE:
if( debug_level > 3 )
cout << "#" << node->GetApplication_instance()->StepFileId() <<
" change node to InstMgr's new list\n";
node->ChangeState( listState );
break;
case deleteSE:
if( debug_level > 3 )
cout << "#" << node->GetApplication_instance()->StepFileId() <<
" change node to InstMgr's delete list\n";
node->ChangeState( listState );
break;
case noStateSE:
cout << "#" << node->GetApplication_instance()->StepFileId() <<
"ERROR can't change this node state\n";
node->Remove();
break;
}
}
///////////////////////////////////////////////////////////////////////////////
/**************************************************
description:
This function returns an integer value indicating
the number of instances with the given name appearing
on the instance manager.
**************************************************/
int
InstMgr::EntityKeywordCount( const char * name ) {
int count = 0;
MgrNode * node;
SDAI_Application_instance * se;
int n = InstanceCount();
for( int j = 0; j < n; ++j ) {
node = GetMgrNode( j );
se = node->GetApplication_instance();
if( !strcmp( se->EntityName(),
PrettyTmpName( name ) ) ) {
++count;
}
}
return count;
}
///////////////////////////////////////////////////////////////////////////////
SDAI_Application_instance *
InstMgr::GetApplication_instance( int index ) {
MgrNode * mn = ( MgrNode * )( *master )[index];
if( mn ) {
return mn->GetApplication_instance();
} else {
return 0;
}
}
SDAI_Application_instance *
InstMgr::GetSTEPentity( int index ) {
MgrNode * mn = ( MgrNode * )( *master )[index];
if( mn ) {
return mn->GetApplication_instance();
} else {
return 0;
}
}
///////////////////////////////////////////////////////////////////////////////
/**************************************************
description:
This function returns the first entity (by index)
on the instance manager, which has the given
entity name. It starts its search at starting_index,
and returns ENTITY_NULL if a match does not occur
before the last index is reached. This function
does not wrap around to search indices before the
starting_index.
**************************************************/
SDAI_Application_instance *
InstMgr::GetApplication_instance( const char * entityKeyword, int starting_index ) {
MgrNode * node;
SDAI_Application_instance * se;
int count = InstanceCount();
for( int j = starting_index; j < count; ++j ) {
node = GetMgrNode( j );
se = node->GetApplication_instance();
if( !strcmp( se->EntityName(),
PrettyTmpName( entityKeyword ) ) ) {
return se;
}
}
return ENTITY_NULL;
}
SDAI_Application_instance *
InstMgr::GetSTEPentity( const char * entityKeyword, int starting_index ) {
MgrNode * node;
SDAI_Application_instance * se;
int count = InstanceCount();
for( int j = starting_index; j < count; ++j ) {
node = GetMgrNode( j );
se = node->GetApplication_instance();
if( !strcmp( se->EntityName(),
PrettyTmpName( entityKeyword ) ) ) {
return se;
}
}
return ENTITY_NULL;
}
///////////////////////////////////////////////////////////////////////////////
void *
InstMgr::GetSEE( int index ) {
MgrNode * mn = ( MgrNode * )( *master )[index];
if( mn ) {
return mn->SEE();
} else {
return 0;
}
}

128
src/clstepcore/instmgr.h Normal file
View file

@ -0,0 +1,128 @@
#ifndef instmgr_h
#define instmgr_h
/*
* NIST STEP Editor Class Library
* cleditor/instmgr.h
* April 1997
* David Sauder
* K. C. Morris
* Development of this software was funded by the United States Government,
* and is not subject to copyright.
*/
///// future? TODO? ////////////////
// InstMgr can maintain an undo list for the last operation
// performed on a node
// InstMgr can have a startUndo() and endUndo() so it knows when to
// start a new undo list and delete the old undo list.
/////////////////////
#include <scl_export.h>
// IT IS VERY IMPORTANT THAT THE ORDER OF THE FOLLOWING INCLUDE FILES
// BE PRESERVED
#include <gennode.h>
#include <gennodelist.h>
#include <gennodearray.h>
#include <mgrnode.h>
#include <mgrnodelist.h>
#include <dispnode.h>
#include <dispnodelist.h>
#include <mgrnodearray.h>
class SCL_CORE_EXPORT InstMgr {
protected:
int maxFileId;
int _ownsInstances; // if true will delete instances inside destructor
MgrNodeArray * master; // master array of all MgrNodes made up of
// complete, incomplete, new, delete MgrNodes lists
// this corresponds to the display list object by index
MgrNodeArraySorted * sortedMaster; // master array sorted by fileId
// StateList *master; // this will be an sorted array of ptrs to MgrNodes
public:
InstMgr( int ownsInstances = 0 );
virtual ~InstMgr();
// MASTER LIST OPERATIONS
int InstanceCount() const {
return master->Count();
}
int OwnsInstances() const {
return _ownsInstances;
}
void OwnsInstances( int ownsInstances ) {
_ownsInstances = ownsInstances;
}
void ClearInstances(); //clears instance lists but doesn't delete instances
void DeleteInstances(); // deletes the instances (ignores _ownsInstances)
Severity VerifyInstances( ErrorDescriptor & e );
// DAS PORT possible BUG two funct's below may create a temp for the cast
MgrNode * GetMgrNode( int index ) {
return ( MgrNode * ) *GetGenNode( index );
}
GenericNode ** GetGenNode( int index ) {
return &( *master ) [index];
}
MgrNode * FindFileId( int fileId );
// get the index into display list given a SDAI_Application_instance
// called by see initiated functions
int GetIndex( SDAI_Application_instance *se );
int GetIndex( MgrNode * mn );
int VerifyEntity( int fileId, const char * expectedType );
// void Append(MgrNode *node);
MgrNode * Append( SDAI_Application_instance *se, stateEnum listState );
// deletes node from master list structure
void Delete( MgrNode * node );
void Delete( SDAI_Application_instance *se );
void ChangeState( MgrNode * node, stateEnum listState );
int MaxFileId() {
return maxFileId;
}
int NextFileId() {
return maxFileId = maxFileId + 1;
}
int EntityKeywordCount( const char * name );
SDAI_Application_instance * GetApplication_instance( int index );
SDAI_Application_instance *
GetApplication_instance( const char * entityKeyword,
int starting_index = 0 );
SDAI_Application_instance * GetApplication_instance( MgrNode * node ) {
return node->GetApplication_instance();
};
void * GetSEE( int index );
void * GetSEE( MgrNode * node ) {
return node->SEE();
};
void PrintSortedFileIds();
// OBSOLETE
SDAI_Application_instance * GetSTEPentity( int index );
SDAI_Application_instance * GetSTEPentity( const char * entityKeyword,
int starting_index = 0 );
SDAI_Application_instance * GetSTEPentity( MgrNode * node ) {
return node->GetApplication_instance();
};
};
#endif

View file

@ -1,4 +1,4 @@
/*************************************************************************//**
/*****************************************************************************
* \file match-ors.cc *
* *
* Description: Contains the matchORs() functions for the EntList descen- *

204
src/clstepcore/mgrnode.cc Normal file
View file

@ -0,0 +1,204 @@
/*
* NIST STEP Editor Class Library
* cleditor/mgrnode.cc
* April 1997
* David Sauder
* K. C. Morris
* Development of this software was funded by the United States Government,
* and is not subject to copyright.
*/
/* $Id: mgrnode.cc,v 3.0.1.3 1997/11/05 22:11:37 sauderd DP3.1 $ */
#include <mgrnode.h>
#include <mgrnodelist.h>
#include <dispnode.h>
#include <dispnodelist.h>
#include <instmgr.h>
//#include <STEPentity.h>
#include <sdai.h>
#include <iostream>
#include "scl_memmgr.h"
void * MgrNode::SEE() {
return ( di ? di->SEE() : 0 );
}
int MgrNode::GetFileId() {
return ( se ? se->GetFileId() : -1 );
}
void MgrNode::Remove() {
// if(debug_level >= PrintFunctionTrace)
// cout << "MgrNode::Remove()\n";
// if(debug_level >= PrintValues)
// cout << "MgrNode::this : '" << this << "'\n";
GenericNode::Remove();
// DON'T DO THIS!! currState = noStateSE;
}
// searches current list for fileId
MgrNode * MgrNode::StateFindFileId( int fileId ) {
// if(debug_level >= PrintFunctionTrace)
// cout << "MgrNode::StateFindFileId()\n";
MgrNode * startNode = this;
if( startNode->GetFileId() == fileId ) {
return this;
} else {
// mn is really a MgrNode
MgrNode * mn = ( MgrNode * )( startNode->Next() );
while( mn != startNode ) {
if( mn->GetFileId() == fileId ) {
return ( MgrNode * )mn;
}
mn = ( ( MgrNode * )mn->Next() );
}
return ( MgrNode * )0;
}
}
MgrNode::~MgrNode() {
// if(debug_level >= PrintFunctionTrace)
// cout << "MgrNode::~MgrNode()\n";
// if(debug_level >= PrintValues)
// cout << "MgrNode::this : '" << this << "'\n";
if( se ) {
delete se;
}
if( di ) {
delete di;
}
// GenericNode::Remove(); // this is called by default.
}
///////////////////// class MgrNode Display Functions /////////////////////////
displayStateEnum MgrNode::DisplayState() {
// if(debug_level >= PrintFunctionTrace)
// cout << "MgrNode::DisplayState()\n";
return ( di ? di->DisplayState() : noMapState );
}
int MgrNode::IsDisplayState( displayStateEnum ds ) {
// if(debug_level >= PrintFunctionTrace)
// cout << "MgrNode::IsDisplayState()\n";
return ( di ? di->DisplayListMember( ds ) : 0 );
}
GenericNode * MgrNode::NextDisplay() {
// if(debug_level >= PrintFunctionTrace)
// cout << "MgrNode::NextDisplay()\n";
// return (di ? ((DisplayNode *)di->Next()) : (DisplayNode *)0);
if( di ) {
// GenericNode *dn = di->Next();
// return (DisplayNode *)dn;
// return (DisplayNode *)(di->Next());
return di->Next();
} else {
return 0;
}
}
GenericNode * MgrNode::PrevDisplay() {
// if(debug_level >= PrintFunctionTrace)
// cout << "MgrNode::PrevDisplay()\n";
// return (di ? ((DisplayNode *)di->Prev()) : 0);
if( di ) {
return di->Prev();
} else {
return 0;
}
}
// STATE LIST OPERATIONS
// deletes from previous cmd list & puts on cmd list cmdList
int MgrNode::ChangeList( DisplayNodeList * cmdList ) {
if( !di ) {
di = new class DisplayNode( this );
}
return di->ChangeList( cmdList );
}
// deletes from previous cmd list & puts on cmd list cmdList
int MgrNode::ChangeList( MgrNodeList * cmdList ) {
Remove();
cmdList->Append( this );
return 1;
}
int MgrNode::ChangeState( displayStateEnum s ) {
// if(debug_level >= PrintFunctionTrace)
// cout << "MgrNode::ChangeState()\n";
if( di ) {
return di->ChangeState( s );
}
return 0;
}
int MgrNode::ChangeState( stateEnum s ) {
// if(debug_level >= PrintFunctionTrace)
// cout << "MgrNode::ChangeState()\n";
currState = s;
// for now, later need to type check somehow and return success or failure
return 1;
}
void MgrNode::Init( SDAI_Application_instance *s,
stateEnum listState,
MgrNodeList * list ) {
// if(debug_level >= PrintFunctionTrace)
// cout << "MgrNode::Init()\n";
se = s;
arrayIndex = -1;
di = 0;
currState = listState;
if( list ) {
list->Append( this );
}
}
// used for sentinel node on lists of MgrNodes
MgrNode::MgrNode() {
// if(debug_level >= PrintFunctionTrace)
// cout << "MgrNode::MgrNode()\n";
// if(debug_level >= PrintValues)
// cout << "MgrNode::this : '" << this << "'\n";
Init( 0, noStateSE, 0 );
}
MgrNode::MgrNode( SDAI_Application_instance *StepEntPtr ) {
// if(debug_level >= PrintFunctionTrace)
// cout << "MgrNode::MgrNode()\n";
// if(debug_level >= PrintValues)
// cout << "MgrNode::this : '" << this << "'\n";
Init( StepEntPtr, noStateSE, 0 );
}
// 'listState' ==
// completeSE - if reading valid exchange file
// incompleteSE or completeSE - if reading working session file
// newSE - if instance is created by user using editor (probe)
MgrNode::MgrNode( SDAI_Application_instance *StepEntPtr, stateEnum listState ) {
// if(debug_level >= PrintFunctionTrace)
// cout << "MgrNode::MgrNode()\n";
// if(debug_level >= PrintValues)
// cout << "MgrNode::this : '" << this << "'\n";
Init( StepEntPtr, listState, 0 );
}
// 'listState' ==
// completeSE - if reading valid exchange file
// incompleteSE or completeSE - if reading working session file
// newSE - if instance is created by user using editor (probe)
MgrNode::MgrNode( SDAI_Application_instance *StepEntPtr, stateEnum listState, MgrNodeList * list ) {
// if(debug_level >= PrintFunctionTrace)
// cout << "MgrNode::MgrNode()\n";
// if(debug_level >= PrintValues)
// cout << "MgrNode::this : '" << this << "'\n";
Init( StepEntPtr, listState, list );
}

146
src/clstepcore/mgrnode.h Normal file
View file

@ -0,0 +1,146 @@
#ifndef mgrnode_h
#define mgrnode_h
/*
* NIST STEP Editor Class Library
* cleditor/mgrnode.h
* April 1997
* David Sauder
* K. C. Morris
* Development of this software was funded by the United States Government,
* and is not subject to copyright.
*/
/* $Id: mgrnode.h,v 3.0.1.4 1997/11/05 22:11:37 sauderd DP3.1 $ */
#include <scl_export.h>
class GenericNode;
class DisplayNode;
#include <sdai.h>
//class SDAI_Application_instance;
#include <gennode.h>
#include <gennodelist.h>
//#include <gennode.inline.h>
#include <editordefines.h>
class InstMgr;
//////////////////////////////////////////////////////////////////////////////
// class MgrNode
// If you delete this object, it deletes the SDAI_Application_instance it represents,
// the DisplayNode, and removes itself from any list it is in.
//////////////////////////////////////////////////////////////////////////////
class SCL_CORE_EXPORT MgrNode : public GenericNode {
friend class GenNodeList;
friend class MgrNodeList;
friend class InstMgr;
protected:
// currState, next, prev implement several lists
// based on currState:
// currState = (completeSE, incompleteSE, newSE, or deleteSE)
// every node will be on one of the four lists implemented by these:
stateEnum currState;
// SDAI_Application_instance this node is representing info for
SDAI_Application_instance * se;
// this is the index (in the InstMgr master array) of the ptr to
// this node.
int arrayIndex;
// display info (SEE, etc) for this node
DisplayNode * di;
public:
// used for sentinel node on lists of MgrNodes
MgrNode();
MgrNode( SDAI_Application_instance *se );
// 'listState' ==
// completeSE - if reading valid exchange file
// incompleteSE or completeSE - if reading working session file
// newSE - if instance is created by user using editor (probe)
MgrNode( SDAI_Application_instance *se, stateEnum listState );
MgrNode( SDAI_Application_instance *se, stateEnum listState, MgrNodeList * list );
virtual ~MgrNode();
// STATE LIST OPERATIONS
int MgrNodeListMember( stateEnum s ) {
return ( currState == s );
}
stateEnum CurrState() {
return currState;
}
// returns next or prev member variables
// i.e. next or previous node on curr state list
// searches current list for fileId
MgrNode * StateFindFileId( int fileId );
// deletes from previous cmd list,
// & puts on cmd list cmdList
int ChangeList( MgrNodeList * cmdList );
int ChangeState( stateEnum s );
// Removes from current list.
// Called before adding to diff list or when destructor is called.
void Remove();
// DISPLAY LIST OPERATIONS
void * SEE();
displayStateEnum DisplayState();
int IsDisplayState( displayStateEnum ds );
// returns next or prev member variables
// i.e. next or previous node on display state list
GenericNode * NextDisplay();
GenericNode * PrevDisplay();
// deletes from previous cmd list,
// & puts on cmd list cmdList
int ChangeList( DisplayNodeList * cmdList );
// deletes from previous display list, assigns ds to
// displayState & puts on list dsList
int ChangeState( displayStateEnum ds );
// might not want these three? since it won't actually map them?
void MapModifiable( DisplayNodeList * dnList );
void MapViewable( DisplayNodeList * dnList );
void UnMap( DisplayNodeList * dnList );
// ACCESS FUNCTIONS
int GetFileId();
SDAI_Application_instance * GetApplication_instance() {
return se;
}
DisplayNode *& displayNode() {
return di;
}
int ArrayIndex() {
return arrayIndex;
}
void ArrayIndex( int index ) {
arrayIndex = index;
}
// OBSOLETE
SDAI_Application_instance * GetSTEPentity() {
return se;
}
protected:
private:
void Init( SDAI_Application_instance *s, stateEnum listState, MgrNodeList * list );
};
//////////////////////////////////////////////////////////////////////////////
// class MgrNode inline functions
// these functions don't rely on any inline functions (its own or
// other classes) that aren't in this file except for Generic functions
//////////////////////////////////////////////////////////////////////////////
#endif

View file

@ -0,0 +1,242 @@
/*
* NIST STEP Editor Class Library
* cleditor/mgrnodearray.cc
* April 1997
* David Sauder
* K. C. Morris
* Development of this software was funded by the United States Government,
* and is not subject to copyright.
*/
/* $Id: mgrnodearray.cc,v 3.0.1.3 1997/11/05 22:11:38 sauderd DP3.1 $ */
/*
* MgrNodeArray - dynamic array object of MgrNodes.
* the array part of this is copied from Unidraws UArray - dynamic array object
* Copyright (c) 1990 Stanford University
*/
///////////////////////////////////////////////////////////////////////////////
// debug_level >= 2 => tells when a command is chosen
// debug_level >= 3 => prints values within functions:
// e.g. 1) entity type list when read
// 2) entity instance list when read
///////////////////////////////////////////////////////////////////////////////
static int debug_level = 1;
// if debug_level is greater than this number then
// function names get printed out when executed
static int PrintFunctionTrace = 2;
// if debug_level is greater than this number then
// values within functions get printed out
//static int PrintValues = 3;
#include <mgrnodearray.h>
//#include <STEPentity.h>
#include <sdai.h>
#include <string.h> // to get bcopy() - ANSI
#include "scl_memmgr.h"
//////////////////////////////////////////////////////////////////////////////
// class MgrNodeArray member functions
//////////////////////////////////////////////////////////////////////////////
MgrNodeArray::MgrNodeArray( int defaultSize )
: GenNodeArray( defaultSize ) {
}
void MgrNodeArray::AssignIndexAddress( int index ) {
// if(debug_level >= PrintFunctionTrace)
// cout << "MgrNodeArray::AssignIndexAddress()\n";
( ( MgrNode * )_buf[index] )->ArrayIndex( index );
}
MgrNodeArray::~MgrNodeArray() {
if( debug_level >= PrintFunctionTrace ) {
cout << "MgrNodeArray::~MgrNodeArray()\n";
}
DeleteEntries();
}
/*****************************************************************************/
void MgrNodeArray::ClearEntries() {
if( debug_level >= PrintFunctionTrace ) {
cout << "MgrNodeArray::ClearEntries()\n";
}
int i;
for( i = 0 ; i < _count; i++ ) {
_buf[i] = 0;
}
_count = 0;
}
/*****************************************************************************/
void MgrNodeArray::DeleteEntries() {
if( debug_level >= PrintFunctionTrace ) {
cout << "MgrNodeArray::DeleteEntries()\n";
}
int i;
for( i = 0 ; i < _count; i++ ) {
delete( ( MgrNode * )_buf[i] );
}
_count = 0;
}
/*****************************************************************************/
int MgrNodeArray::Insert( GenericNode * gn, int index ) {
if( debug_level >= PrintFunctionTrace ) {
cout << "MgrNodeArray::Insert()\n";
}
int AssignedIndex = GenNodeArray::Insert( gn, index );
int i;
for( i = AssignedIndex ; i < _count; i++ ) {
( ( MgrNode * )_buf[i] )->ArrayIndex( i );
}
return AssignedIndex;
}
/*****************************************************************************/
void MgrNodeArray::Remove( int index ) {
if( debug_level >= PrintFunctionTrace ) {
cout << "MgrNodeArray::Remove()\n";
}
if( 0 <= index && index < _count ) {
GenNodeArray::Remove( index );
int i;
for( i = index; i < _count; i++ ) {
( ( MgrNode * )_buf[i] )->ArrayIndex( i );
}
}
}
/*****************************************************************************/
int MgrNodeArray::MgrNodeIndex( int fileId ) {
if( debug_level >= PrintFunctionTrace ) {
cout << "MgrNodeArray::MgrNodeIndex()\n";
}
int i;
for( i = 0; i < _count; ++i ) {
if( ( ( MgrNode * )_buf[i] )->GetApplication_instance()->GetFileId() == fileId ) {
return i;
}
}
return -1;
}
//////////////////////////////////////////////////////////////////////////////
// class MgrNodeArraySorted member functions
//////////////////////////////////////////////////////////////////////////////
MgrNodeArraySorted::MgrNodeArraySorted( int defaultSize )
: GenNodeArray( defaultSize ) {
}
int MgrNodeArraySorted::Insert( GenericNode * gn ) {
// if(debug_level >= PrintFunctionTrace)
// cout << "MgrNodeArraySorted::Insert()\n";
// since gn is really a MgrNode
int fileId = ( ( MgrNode * )gn )->GetApplication_instance()->GetFileId();
int index = FindInsertPosition( fileId );
return GenNodeArray::Insert( gn, index );
}
int MgrNodeArraySorted::Index( GenericNode * gn ) {
// if(debug_level >= PrintFunctionTrace)
// cout << "MgrNodeArraySorted::Index()\n";
// since gn is really a MgrNode
return MgrNodeIndex( ( ( MgrNode * )gn )->GetFileId() );
}
int MgrNodeArraySorted::Index( GenericNode ** gn ) {
// if(debug_level >= PrintFunctionTrace)
// cout << "MgrNodeArraySorted::Index()\n";
// since gn is really a MgrNode
return MgrNodeIndex( ( ( MgrNode * )( *gn ) )->GetFileId() );
}
void MgrNodeArraySorted::ClearEntries() {
if( debug_level >= PrintFunctionTrace ) {
cout << "MgrNodeArraySorted::ClearEntries()\n";
}
int i;
for( i = 0 ; i < _count; i++ ) {
_buf[i] = 0;
}
_count = 0;
}
/*****************************************************************************/
void MgrNodeArraySorted::DeleteEntries() {
if( debug_level >= PrintFunctionTrace ) {
cout << "MgrNodeArraySorted::DeleteEntries()\n";
}
int i;
for( i = 0 ; i < _count; i++ ) {
delete( ( MgrNode * )_buf[i] );
}
_count = 0;
}
/*****************************************************************************/
// the reason this is written this way is because most of the
// time the file id will be higher than any seen so far and
// thus the insert position will be at the end
int MgrNodeArraySorted::FindInsertPosition( const int fileId ) {
if( debug_level >= PrintFunctionTrace ) {
cout << "MgrNodeArraySorted::FindInsertPosition()\n";
}
int i;
int curFileId;
for( i = _count - 1; i >= 0; --i ) {
curFileId = ( ( MgrNode * )_buf[i] )->GetApplication_instance()->GetFileId();
if( curFileId < fileId /*|| curFileId == fileId*/ ) {
return i + 1;
}
}
return 0;
}
/*****************************************************************************/
int MgrNodeArraySorted::MgrNodeIndex( int fileId ) {
// this function assumes that _buf[0] to _buf[_count] ALL point to MgrNodes
// that are sorted by fileId
if( debug_level >= PrintFunctionTrace ) {
cout << "MgrNodeArraySorted::MgrNodeIndex()\n";
}
int low = 0;
int high = _count - 1;
int mid = 0;
int found = 0;
int curFileId;
while( !found && ( low <= high ) ) {
mid = ( low + high ) / 2;
curFileId = ( ( MgrNode * )_buf[mid] )->GetApplication_instance()->GetFileId();
if( curFileId == fileId ) {
found = 1;
} else if( curFileId < fileId ) {
low = mid + 1;
} else {
high = mid - 1;
}
}
if( found ) {
return mid;
}
return -1;
}

Some files were not shown because too many files have changed in this diff Show more