Compare commits
130
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
142b75ce64 | ||
|
|
f4a0feb33a | ||
|
|
4527aadff6 | ||
|
|
1c12e5d102 | ||
|
|
278e45caa7 | ||
|
|
a9c64bc448 | ||
|
|
261ae1d67e | ||
|
|
1d34753c03 | ||
|
|
aa97040c83 | ||
|
|
c2b87f8f0b | ||
|
|
1a32be9308 | ||
|
|
52bb54d87b | ||
|
|
f9390c6f8c | ||
|
|
e421f70ce0 | ||
|
|
767a01a8f0 | ||
|
|
5af38feaa7 | ||
|
|
2067e48bbd | ||
|
|
883bc716ce | ||
|
|
89f8807c6e | ||
|
|
6c76d7b184 | ||
|
|
1e18361351 | ||
|
|
0bea3efca0 | ||
|
|
225180f35d | ||
|
|
6f60a8a7f9 | ||
|
|
910faf0198 | ||
|
|
dd6ef88aa1 | ||
|
|
6b1ba4aa5d | ||
|
|
5aca33785c | ||
|
|
a1d6b25e75 | ||
|
|
626bb73cb9 | ||
|
|
8a2665e980 | ||
|
|
4740f4d45c | ||
|
|
04f4c1da66 | ||
|
|
0a12237f8b | ||
|
|
c77471a5f8 | ||
|
|
a9173c8b41 | ||
|
|
521f4427ea | ||
|
|
7628642baf | ||
|
|
c446fc391b | ||
|
|
473223d831 | ||
|
|
b4cf4236f2 | ||
|
|
52635e7d8b | ||
|
|
6817e1b868 | ||
|
|
a72fa6eb86 | ||
|
|
a86b035dc7 | ||
|
|
7425e55db7 | ||
|
|
905254125e | ||
|
|
db31ea0455 | ||
|
|
7b54e23e1a | ||
|
|
c676850fab | ||
|
|
b507ee8179 | ||
|
|
347df4f231 | ||
|
|
00ad279a63 | ||
|
|
0878a6d359 | ||
|
|
77ab82b571 | ||
|
|
0a954f1976 | ||
|
|
75706a942a | ||
|
|
d8d293bbf8 | ||
|
|
3be42207ee | ||
|
|
b49d2beb6a | ||
|
|
245ff1458b | ||
|
|
010e02b7a6 | ||
|
|
c84330b26a | ||
|
|
88e09ca813 | ||
|
|
ee13cdaca3 | ||
|
|
b60f85be1d | ||
|
|
f7cde9fc20 | ||
|
|
3010afa7ea | ||
|
|
f5d0cc59aa | ||
|
|
bd320c403d | ||
|
|
e83fc64bc9 | ||
|
|
0e9cc5c6ae | ||
|
|
a215cae560 | ||
|
|
6c708845bf | ||
|
|
2e1befa0bf | ||
|
|
884949bbab | ||
|
|
ea7adb4d18 | ||
|
|
6ada55b7fe | ||
|
|
f705842bb7 | ||
|
|
c1636b4d01 | ||
|
|
0c424b4eb5 | ||
|
|
dea7f8c3a1 | ||
|
|
16e3749b8f | ||
|
|
3953a2268e | ||
|
|
5f1465e4e6 | ||
|
|
f3eab5d91a | ||
|
|
7f588a64cf | ||
|
|
38d2a49967 | ||
|
|
89035cdb2c | ||
|
|
16743b297b | ||
|
|
7ec9f7d8fb | ||
|
|
4e0d73d001 | ||
|
|
7ce8bcbefb | ||
|
|
4d6d249dad | ||
|
|
82c84e7337 | ||
|
|
4d68ec0b19 | ||
|
|
69e0813cf7 | ||
|
|
d0e2c156a1 | ||
|
|
b84921e9d8 | ||
|
|
d3418ed48c | ||
|
|
96f5f28058 | ||
|
|
ca155ce50d | ||
|
|
1bbbc219ba | ||
|
|
59cf7ec1ed | ||
|
|
f053df82db | ||
|
|
8cad6ec2aa | ||
|
|
5f345c700e | ||
|
|
37594fc4a2 | ||
|
|
d6da97ec30 | ||
|
|
5f88f509b2 | ||
|
|
d87d07a26c | ||
|
|
50b9032d32 | ||
|
|
d56795946c | ||
|
|
117ba3972f | ||
|
|
8595a291cb | ||
|
|
ee78ba9c52 | ||
|
|
575c77dda9 | ||
|
|
bd9942dc36 | ||
|
|
10999e7a48 | ||
|
|
becb8405ba | ||
|
|
dca5e0c843 | ||
|
|
47ecd2088f | ||
|
|
1cc2774b52 | ||
|
|
3fd222218f | ||
|
|
212c11453e | ||
|
|
260fd55f10 | ||
|
|
d94a44944b | ||
|
|
2be1cc40be | ||
|
|
809e1dd495 | ||
|
|
3aee5f353c |
@@ -13,6 +13,7 @@ Morrison, Christopher Sean (sean, morrison, brlcad)
|
||||
Paviot, Thomas (tpaviot)
|
||||
Pictor, Mark (mpictor)
|
||||
Thomas, Dawn (homovulgaris, madant)
|
||||
Wouters, Dave (davyw)
|
||||
Yapp, Clifford (starseeker)
|
||||
|
||||
Special thanks:
|
||||
|
||||
+195
-105
@@ -38,36 +38,61 @@
|
||||
# This file contains the top level CMakeLists.txt logic for the
|
||||
# SCL software package.
|
||||
|
||||
PROJECT(SCL)
|
||||
|
||||
# SCL version
|
||||
SET(SCL_VERSION_MAJOR 0)
|
||||
SET(SCL_VERSION_MINOR 5-dev)
|
||||
SET(SCL_VERSION ${SCL_VERSION_MAJOR}.${SCL_VERSION_MINOR})
|
||||
|
||||
# SCL ABI version. SCL_ABI_SOVERSION should be incremented
|
||||
# for each release introducing API incompatibilities
|
||||
SET(SCL_ABI_SOVERSION 2)
|
||||
SET(SCL_ABI_VERSION ${SCL_ABI_SOVERSION}.0.0)
|
||||
|
||||
# Minimum required version of CMake
|
||||
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
|
||||
IF(COMMAND CMAKE_POLICY)
|
||||
CMAKE_POLICY(SET CMP0003 NEW)
|
||||
CMAKE_POLICY(SET CMP0003 NEW)
|
||||
ENDIF(COMMAND CMAKE_POLICY)
|
||||
|
||||
# set CMake project name
|
||||
PROJECT(SCL)
|
||||
IF( NOT DEFINED SCL_BUILD_TYPE )
|
||||
SET( SCL_BUILD_TYPE "Debug" CACHE STRING "Build type" ) # By default set debug build
|
||||
ENDIF( NOT DEFINED SCL_BUILD_TYPE )
|
||||
IF(NOT SCL_IS_SUBBUILD)
|
||||
SET(CMAKE_BUILD_TYPE ${SCL_BUILD_TYPE} CACHE INTERNAL "Build type, immutable" FORCE )
|
||||
ELSE(NOT SCL_IS_SUBBUILD)
|
||||
SET(CMAKE_BUILD_TYPE ${SCL_BUILD_TYPE} )
|
||||
ENDIF(NOT SCL_IS_SUBBUILD)
|
||||
|
||||
if( CMAKE_BUILD_TYPE STREQUAL "" )
|
||||
message( "-- Debug build - to override, rerun cmake with '-DCMAKE_BUILD_TYPE=Release'." )
|
||||
set( CMAKE_BUILD_TYPE Debug )
|
||||
endif()
|
||||
# Define helper macro OPTION_WITH_DEFAULT
|
||||
MACRO( OPTION_WITH_DEFAULT OPTION_NAME OPTION_STRING OPTION_DEFAULT )
|
||||
IF( NOT DEFINED ${OPTION_NAME} )
|
||||
SET( ${OPTION_NAME} ${OPTION_DEFAULT} )
|
||||
ENDIF( NOT DEFINED ${OPTION_NAME} )
|
||||
OPTION( ${OPTION_NAME} "${OPTION_STRING}" ${${OPTION_NAME}} )
|
||||
ENDMACRO( OPTION_WITH_DEFAULT OPTION_NAME OPTION_STRING OPTION_DEFAULT )
|
||||
|
||||
# build shared libs by default
|
||||
OPTION(BUILD_SHARED_LIBS "Build shared libraries" ON)
|
||||
OPTION_WITH_DEFAULT(SCL_BUILD_SHARED_LIBS "Build shared libs" ON )
|
||||
|
||||
# build static libs by default
|
||||
OPTION(BUILD_STATIC_LIBS "Build static libraries" OFF)
|
||||
# don't build static libs by default
|
||||
OPTION_WITH_DEFAULT(SCL_BUILD_STATIC_LIBS "Build static libs" OFF)
|
||||
|
||||
# Set version
|
||||
SET(SCL_VERSION_MAJOR "3")
|
||||
SET(SCL_VERSION_MINOR "2")
|
||||
SET(SCL_VERSION_PATCH "0")
|
||||
SET(SCL_VERSION "${SCL_VERSION_MAJOR}.${SCL_VERSION_MINOR}.${SCL_VERSION_PATCH}")
|
||||
OPTION_WITH_DEFAULT(SCL_PYTHON_GENERATOR "Compile fedex_python" ON)
|
||||
OPTION_WITH_DEFAULT(SCL_CPP_GENERATOR "Compile fedex_plus" ON)
|
||||
|
||||
OPTION_WITH_DEFAULT(SCL_MEMMGR_ENABLE_CHECKS "Enable scl_memmgr's memory leak detection" OFF)
|
||||
OPTION_WITH_DEFAULT(SCL_TRACE_FPRINTF "Enable extra comments in generated code so the code's source in fedex_plus may be located" OFF)
|
||||
|
||||
# CMake derives much of its functionality from modules, typically
|
||||
# stored in one directory - let CMake know where to find them.
|
||||
SET(SCL_CMAKE_DIR "${SCL_SOURCE_DIR}/cmake")
|
||||
SET(CMAKE_MODULE_PATH "${SCL_CMAKE_DIR};${CMAKE_MODULE_PATH}")
|
||||
if(NOT IS_SUBBUILD)
|
||||
SET(CMAKE_MODULE_PATH "${SCL_CMAKE_DIR};${CMAKE_MODULE_PATH}")
|
||||
else(NOT IS_SUBBUILD)
|
||||
SET(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH};${SCL_CMAKE_DIR}")
|
||||
endif(NOT IS_SUBBUILD)
|
||||
|
||||
INCLUDE(${SCL_CMAKE_DIR}/SCL_Utils.cmake)
|
||||
|
||||
@@ -77,91 +102,89 @@ SET(_orig_lc_all $ENV{LC_ALL})
|
||||
SET(_orig_lc_messages $ENV{LC_MESSAGES})
|
||||
SET(_orig_lang $ENV{LANG})
|
||||
IF(_orig_lc_all)
|
||||
SET(ENV{LC_ALL} C)
|
||||
SET(ENV{LC_ALL} C)
|
||||
ENDIF(_orig_lc_all)
|
||||
IF(_orig_lc_messages)
|
||||
SET(ENV{LC_MESSAGES} C)
|
||||
SET(ENV{LC_MESSAGES} C)
|
||||
ENDIF(_orig_lc_messages)
|
||||
IF(_orig_lang)
|
||||
SET(ENV{LANG} C)
|
||||
SET(ENV{LANG} C)
|
||||
ENDIF(_orig_lang)
|
||||
|
||||
# For NFS volumes, to ensure proper file creation.
|
||||
IF(NOT WIN32)
|
||||
IF(NOT UMASK)
|
||||
EXEC_PROGRAM(umask ARGS 022 OUTPUT_VARIABLE exec_out)
|
||||
ELSE(NOT UMASK)
|
||||
EXEC_PROGRAM(umask ARGS ${UMASK} OUTPUT_VARIABLE exec_out)
|
||||
ENDIF(NOT UMASK)
|
||||
ENDIF(NOT WIN32)
|
||||
|
||||
#---------------------------------------------------------------------
|
||||
# Testing option
|
||||
OPTION( ENABLE_TESTING "Enable unittesting framework" OFF )
|
||||
IF(ENABLE_TESTING)
|
||||
set( CMAKE_EXE_LINKER_FLAGS "-fprofile-arcs -ftest-coverage" ) #for code coverage
|
||||
set( CMAKE_SHARED_LINKER_FLAGS "-fprofile-arcs -ftest-coverage" )
|
||||
if( NOT DEFINED BUILD_SCHEMAS )
|
||||
set( BUILD_SCHEMAS "ALL" ) #test all schemas, unless otherwise specified
|
||||
endif()
|
||||
INCLUDE(CTest)
|
||||
ENABLE_TESTING()
|
||||
ENDIF(ENABLE_TESTING)
|
||||
OPTION_WITH_DEFAULT( SCL_ENABLE_TESTING "Enable unittesting framework" OFF )
|
||||
IF(SCL_ENABLE_TESTING)
|
||||
if( NOT DEFINED SCL_BUILD_SCHEMAS )
|
||||
set( SCL_BUILD_SCHEMAS "ALL" ) #test all schemas, unless otherwise specified
|
||||
endif()
|
||||
INCLUDE(CTest)
|
||||
ENABLE_TESTING()
|
||||
ENDIF(SCL_ENABLE_TESTING)
|
||||
|
||||
#---------------------------------------------------------------------
|
||||
# The following logic is what allows binaries to run successfully in
|
||||
# the build directory AND install directory. Thanks to plplot for
|
||||
# Coverage option
|
||||
OPTION_WITH_DEFAULT( SCL_ENABLE_COVERAGE "Enable code coverage test" OFF )
|
||||
IF(SCL_ENABLE_COVERAGE)
|
||||
SET(SCL_ENABLE_TESTING ON CACHE BOOL "Testing enabled by coverage option" FORCE)
|
||||
# build static libs, better coverage report
|
||||
SET(SCL_BUILD_SHARED_LIBS OFF CACHE BOOL "Build shared libs" FORCE )
|
||||
SET(SCL_BUILD_STATIC_LIBS ON CACHE BOOL "Build static libs" FORCE )
|
||||
SET(CMAKE_CXX_FLAGS_DEBUG "-O0 -g -fprofile-arcs -ftest-coverage" CACHE STRING "Extra compile flags required by code coverage" FORCE)
|
||||
SET(CMAKE_C_FLAGS_DEBUG "-O0 -g -fprofile-arcs -ftest-coverage" CACHE STRING "Extra compile flags required by code coverage" FORCE)
|
||||
SET(CMAKE_MODULE_LINKER_FLAGS_DEBUG "-fprofile-arcs -ftest-coverage" CACHE STRING "Extra linker flags required by code coverage" FORCE)
|
||||
SET(SCL_BUILD_TYPE "Debug" CACHE STRING "Build type required by testing framework" FORCE)
|
||||
ENDIF(SCL_ENABLE_COVERAGE)
|
||||
|
||||
#---------------------------------------------------------------------
|
||||
# The following logic is what allows binaries to run successfully in
|
||||
# the build directory AND install directory. Thanks to plplot for
|
||||
# identifying the necessity of setting CMAKE_INSTALL_NAME_DIR on OSX.
|
||||
# Documentation of these options is available at
|
||||
# http://www.cmake.org/Wiki/CMake_RPATH_handling
|
||||
|
||||
# use, i.e. don't skip the full RPATH for the build tree
|
||||
SET(CMAKE_SKIP_BUILD_RPATH FALSE)
|
||||
set(CMAKE_SKIP_BUILD_RPATH FALSE)
|
||||
|
||||
# when building, don't use the install RPATH already
|
||||
# (but later on when installing)
|
||||
SET(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
|
||||
set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
|
||||
|
||||
# the RPATH/INSTALL_NAME_DIR to be used when installing
|
||||
if (NOT APPLE)
|
||||
SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
|
||||
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib:\$ORIGIN/../lib")
|
||||
endif(NOT APPLE)
|
||||
SET(CMAKE_INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/lib")
|
||||
# On OSX, we need to set INSTALL_NAME_DIR instead of RPATH
|
||||
# http://www.cmake.org/cmake/help/cmake-2-8-docs.html#variable:CMAKE_INSTALL_NAME_DIR
|
||||
set(CMAKE_INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/lib")
|
||||
|
||||
# add the automatically determined parts of the RPATH which point to
|
||||
# add the automatically determined parts of the RPATH which point to
|
||||
# directories outside the build tree to the install RPATH
|
||||
SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
|
||||
|
||||
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Output directories.
|
||||
IF(NOT CMAKE_LIBRARY_OUTPUT_DIRECTORY)
|
||||
IF(WIN32)
|
||||
SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${SCL_BINARY_DIR}/bin CACHE INTERNAL "Single output directory for building all libraries.")
|
||||
ELSE(WIN32)
|
||||
SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${SCL_BINARY_DIR}/lib CACHE INTERNAL "Single output directory for building all libraries.")
|
||||
ENDIF(WIN32)
|
||||
SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${SCL_BINARY_DIR}/lib CACHE INTERNAL "Single output directory for building all libraries.")
|
||||
ENDIF(NOT CMAKE_LIBRARY_OUTPUT_DIRECTORY)
|
||||
IF(NOT CMAKE_ARCHIVE_OUTPUT_DIRECTORY)
|
||||
SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${SCL_BINARY_DIR}/lib CACHE INTERNAL "Single output directory for building all archives.")
|
||||
SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${SCL_BINARY_DIR}/lib CACHE INTERNAL "Single output directory for building all archives.")
|
||||
ENDIF(NOT CMAKE_ARCHIVE_OUTPUT_DIRECTORY)
|
||||
IF(NOT CMAKE_RUNTIME_OUTPUT_DIRECTORY)
|
||||
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${SCL_BINARY_DIR}/bin CACHE INTERNAL "Single output directory for building all executables.")
|
||||
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${SCL_BINARY_DIR}/bin CACHE INTERNAL "Single output directory for building all executables.")
|
||||
ENDIF(NOT CMAKE_RUNTIME_OUTPUT_DIRECTORY)
|
||||
|
||||
FOREACH(CFG_TYPE ${CMAKE_CONFIGURATION_TYPES})
|
||||
STRING(TOUPPER "${CFG_TYPE}" CFG_TYPE)
|
||||
IF(NOT "CMAKE_LIBRARY_OUTPUT_DIRECTORY_${CFG_TYPE}")
|
||||
IF(WIN32)
|
||||
SET("CMAKE_LIBRARY_OUTPUT_DIRECTORY_${CFG_TYPE}" ${SCL_BINARY_DIR}/bin CACHE INTERNAL "Single output directory for building all libraries.")
|
||||
ELSE(WIN32)
|
||||
SET("CMAKE_LIBRARY_OUTPUT_DIRECTORY_${CFG_TYPE}" ${SCL_BINARY_DIR}/lib CACHE INTERNAL "Single output directory for building all libraries.")
|
||||
ENDIF(WIN32)
|
||||
ENDIF(NOT "CMAKE_LIBRARY_OUTPUT_DIRECTORY_${CFG_TYPE}")
|
||||
IF(NOT "CMAKE_ARCHIVE_OUTPUT_DIRECTORY_${CFG_TYPE}")
|
||||
SET("CMAKE_ARCHIVE_OUTPUT_DIRECTORY_${CFG_TYPE}" ${SCL_BINARY_DIR}/lib CACHE INTERNAL "Single output directory for building all archives.")
|
||||
ENDIF(NOT "CMAKE_ARCHIVE_OUTPUT_DIRECTORY_${CFG_TYPE}")
|
||||
IF(NOT "CMAKE_RUNTIME_OUTPUT_DIRECTORY_${CFG_TYPE}")
|
||||
SET("CMAKE_RUNTIME_OUTPUT_DIRECTORY_${CFG_TYPE}" ${SCL_BINARY_DIR}/bin CACHE INTERNAL "Single output directory for building all executables.")
|
||||
ENDIF(NOT "CMAKE_RUNTIME_OUTPUT_DIRECTORY_${CFG_TYPE}")
|
||||
STRING(TOUPPER "${CFG_TYPE}" CFG_TYPE)
|
||||
IF(NOT "CMAKE_LIBRARY_OUTPUT_DIRECTORY_${CFG_TYPE}")
|
||||
SET("CMAKE_LIBRARY_OUTPUT_DIRECTORY_${CFG_TYPE}" ${SCL_BINARY_DIR}/lib CACHE INTERNAL "Single output directory for building all libraries.")
|
||||
ENDIF(NOT "CMAKE_LIBRARY_OUTPUT_DIRECTORY_${CFG_TYPE}")
|
||||
IF(NOT "CMAKE_ARCHIVE_OUTPUT_DIRECTORY_${CFG_TYPE}")
|
||||
SET("CMAKE_ARCHIVE_OUTPUT_DIRECTORY_${CFG_TYPE}" ${SCL_BINARY_DIR}/lib CACHE INTERNAL "Single output directory for building all archives.")
|
||||
ENDIF(NOT "CMAKE_ARCHIVE_OUTPUT_DIRECTORY_${CFG_TYPE}")
|
||||
IF(NOT "CMAKE_RUNTIME_OUTPUT_DIRECTORY_${CFG_TYPE}")
|
||||
SET("CMAKE_RUNTIME_OUTPUT_DIRECTORY_${CFG_TYPE}" ${SCL_BINARY_DIR}/bin CACHE INTERNAL "Single output directory for building all executables.")
|
||||
ENDIF(NOT "CMAKE_RUNTIME_OUTPUT_DIRECTORY_${CFG_TYPE}")
|
||||
ENDFOREACH()
|
||||
|
||||
|
||||
@@ -171,33 +194,46 @@ ENDFOREACH()
|
||||
# The location in which to install SCL. Need a good Debug location
|
||||
# for Windows. Only do this if CMAKE_INSTALL_PREFIX hasn't been set
|
||||
# already, to try and allow parent builds (if any) some control.
|
||||
IF(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
|
||||
IF(NOT WIN32)
|
||||
IF ("${CMAKE_BUILD_TYPE}" MATCHES "Release")
|
||||
SET(CMAKE_INSTALL_PREFIX "/usr")
|
||||
ELSEIF ("${CMAKE_BUILD_TYPE}" MATCHES "Debug")
|
||||
SET(CMAKE_INSTALL_PREFIX "${SCL_SOURCE_DIR}/../scl-install")
|
||||
MESSAGE("--- Setting debug install dir to ${CMAKE_INSTALL_PREFIX}")
|
||||
ELSE("${CMAKE_BUILD_TYPE}" MATCHES "Release")
|
||||
SET(CMAKE_INSTALL_PREFIX "/usr/local")
|
||||
ENDIF ("${CMAKE_BUILD_TYPE}" MATCHES "Release")
|
||||
ENDIF(NOT WIN32)
|
||||
SET(CMAKE_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX} CACHE STRING "SCL install prefix" FORCE)
|
||||
SET(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT 0)
|
||||
ENDIF(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
|
||||
if(NOT SCL_IS_SUBBUILD)
|
||||
IF(NOT WIN32)
|
||||
IF (${CMAKE_BUILD_TYPE} MATCHES "Debug")
|
||||
SET(SCL_INSTALL_PREFIX "${SCL_SOURCE_DIR}/../scl-install")
|
||||
ELSE()
|
||||
SET(SCL_INSTALL_PREFIX "/usr/local")
|
||||
ENDIF()
|
||||
ENDIF(NOT WIN32)
|
||||
SET( SCL_INSTALL_PREFIX ${SCL_INSTALL_PREFIX} CACHE
|
||||
PATH "Install prefix prepended to target to create install location" )
|
||||
SET( CMAKE_INSTALL_PREFIX ${SCL_INSTALL_PREFIX} CACHE INTERNAL "Prefix prepended to install directories if target destination is not absolute, immutable" FORCE )
|
||||
endif(NOT SCL_IS_SUBBUILD)
|
||||
|
||||
OPTION(SCL-BUILD_EXPRESS_ONLY "Only build express parser." OFF)
|
||||
MARK_AS_ADVANCED(SCL-BUILD_EXPRESS_ONLY)
|
||||
OPTION(SCL_BUILD_EXPRESS_ONLY "Only build express parser." OFF)
|
||||
MARK_AS_ADVANCED(SCL_BUILD_EXPRESS_ONLY)
|
||||
|
||||
# Take the scl config file template and copy it to the build directory so CMake
|
||||
# scripts can append to it if need be
|
||||
configure_file(${SCL_SOURCE_DIR}/include/scl_cf_cmake.h.in ${SCL_BINARY_DIR}/include/scl_cf.h.in COPYONLY)
|
||||
# Take the scl config file template as the starting point for
|
||||
# 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(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)
|
||||
macro(CONFIG_H_APPEND PROJECT_NAME NEW_CONTENTS)
|
||||
if(PROJECT_NAME)
|
||||
get_property(${PROJECT_NAME}_CONFIG_H_CONTENTS GLOBAL PROPERTY ${PROJECT_NAME}_CONFIG_H_CONTENTS)
|
||||
set(${PROJECT_NAME}_CONFIG_H_FILE_CONTENTS "${${PROJECT_NAME}_CONFIG_H_CONTENTS}${NEW_CONTENTS}")
|
||||
set_property(GLOBAL PROPERTY ${PROJECT_NAME}_CONFIG_H_CONTENTS "${${PROJECT_NAME}_CONFIG_H_FILE_CONTENTS}")
|
||||
endif(PROJECT_NAME)
|
||||
endmacro(CONFIG_H_APPEND NEW_CONTENTS)
|
||||
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}")
|
||||
|
||||
INCLUDE(CheckLibraryExists)
|
||||
INCLUDE(CheckIncludeFile)
|
||||
INCLUDE(CheckFunctionExists)
|
||||
INCLUDE(CheckTypeSize)
|
||||
INCLUDE(CMakePushCheckState)
|
||||
INCLUDE(CheckCXXSourceRuns)
|
||||
INCLUDE(${SCL_CMAKE_DIR}/FindLEX.cmake)
|
||||
INCLUDE(${SCL_CMAKE_DIR}/FindYACC.cmake)
|
||||
|
||||
@@ -219,56 +255,110 @@ CHECK_FUNCTION_EXISTS(getopt HAVE_GETOPT)
|
||||
|
||||
CHECK_TYPE_SIZE("ssize_t" SSIZE_T)
|
||||
|
||||
set( TEST_STD_THREAD "
|
||||
#include <iostream>
|
||||
#include <thread>
|
||||
void do_work() {
|
||||
std::cout << \"thread\" << std::endl;
|
||||
}
|
||||
int main() {
|
||||
std::thread t(do_work);
|
||||
t.join();
|
||||
}
|
||||
" )
|
||||
cmake_push_check_state()
|
||||
if( UNIX )
|
||||
set( CMAKE_REQUIRED_FLAGS "-pthread -std=c++0x" )
|
||||
else( UNIX )
|
||||
# vars probably need set for MSVC11, embarcadero, etc
|
||||
endif( UNIX )
|
||||
CHECK_CXX_SOURCE_RUNS( "${TEST_STD_THREAD}" HAVE_STD_THREAD ) #quotes are *required*!
|
||||
cmake_pop_check_state()
|
||||
|
||||
# Now that all the tests are done, configure the scl_cf.h file:
|
||||
configure_file(${SCL_BINARY_DIR}/include/scl_cf.h.in ${SCL_BINARY_DIR}/include/scl_cf.h)
|
||||
get_property(CONFIG_H_FILE_CONTENTS GLOBAL PROPERTY SCL_CONFIG_H_CONTENTS)
|
||||
file(WRITE ${CONFIG_H_FILE} "${CONFIG_H_FILE_CONTENTS}")
|
||||
configure_file(${CONFIG_H_FILE} ${SCL_BINARY_DIR}/include/scl_cf.h)
|
||||
|
||||
################ create scl_version_string.h, http://stackoverflow.com/questions/3780667
|
||||
# Using 'ver_string' instead of 'scl_version_string.h' is a trick to force the
|
||||
# command to always execute when the custom target is built. It works because
|
||||
# a file by that name never exists.
|
||||
add_custom_target(version_string ALL
|
||||
DEPENDS ver_string )
|
||||
configure_file(${SCL_CMAKE_DIR}/scl_version_string.cmake ${SCL_BINARY_DIR}/scl_version_string.cmake @ONLY)
|
||||
add_custom_target(version_string ALL DEPENDS ver_string )
|
||||
# creates scl_version_string.h using cmake script
|
||||
add_custom_command(OUTPUT ver_string ${CMAKE_CURRENT_BINARY_DIR}/include/scl_version_string.h
|
||||
COMMAND ${CMAKE_COMMAND} -DSOURCE_DIR=${SCL_SOURCE_DIR}
|
||||
-DBINARY_DIR=${SCL_BINARY_DIR}
|
||||
-P ${SCL_CMAKE_DIR}/scl_version_string.cmake)
|
||||
-P ${SCL_BINARY_DIR}/scl_version_string.cmake)
|
||||
# scl_version_string.h is a generated file
|
||||
set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/include/scl_version_string.h
|
||||
PROPERTIES GENERATED TRUE
|
||||
HEADER_FILE_ONLY TRUE )
|
||||
PROPERTIES GENERATED TRUE
|
||||
HEADER_FILE_ONLY TRUE )
|
||||
################
|
||||
|
||||
if(MSVC)
|
||||
# add_definitions( -Wall )
|
||||
add_definitions( -D__MSVC__ -D__WIN32__ )
|
||||
# Disable warning for preferred usage of secure functions (example strcpy should be strcpy_s, ...)
|
||||
add_definitions( -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_WARNINGS )
|
||||
# add_definitions( -Wall )
|
||||
add_definitions( -D__MSVC__ -D__WIN32__ )
|
||||
# Disable warning for preferred usage of secure functions (example strcpy should be strcpy_s, ...)
|
||||
add_definitions( -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_WARNINGS )
|
||||
elseif(BORLAND)
|
||||
add_definitions( -D__BORLAND__ -D__WIN32__ )
|
||||
add_definitions( -D__BORLAND__ -D__WIN32__ )
|
||||
else()
|
||||
add_definitions( -pedantic -W -Wall -Wundef -Wfloat-equal -Wshadow -Winline -Wno-long-long )
|
||||
add_definitions( -pedantic -W -Wall -Wundef -Wfloat-equal -Wshadow -Winline -Wno-long-long )
|
||||
endif()
|
||||
|
||||
include_directories(
|
||||
${SCL_SOURCE_DIR}/include
|
||||
${SCL_BINARY_DIR}/include
|
||||
)
|
||||
${SCL_SOURCE_DIR}/include
|
||||
${SCL_BINARY_DIR}/include
|
||||
)
|
||||
|
||||
ADD_SUBDIRECTORY(src/base)
|
||||
ADD_SUBDIRECTORY(src/express)
|
||||
ADD_SUBDIRECTORY(src/exppp)
|
||||
ADD_SUBDIRECTORY(src/fedex_plus)
|
||||
ADD_SUBDIRECTORY(src/fedex_python)
|
||||
ADD_SUBDIRECTORY(src/clstepcore)
|
||||
ADD_SUBDIRECTORY(src/cleditor)
|
||||
ADD_SUBDIRECTORY(src/cldai)
|
||||
ADD_SUBDIRECTORY(src/clutils)
|
||||
ADD_SUBDIRECTORY(include)
|
||||
ADD_SUBDIRECTORY(data)
|
||||
IF(ENABLE_TESTING)
|
||||
ADD_SUBDIRECTORY( test )
|
||||
ENDIF(ENABLE_TESTING)
|
||||
IF(SCL_ENABLE_TESTING)
|
||||
ADD_SUBDIRECTORY( test )
|
||||
ENDIF(SCL_ENABLE_TESTING)
|
||||
ADD_SUBDIRECTORY(doc)
|
||||
|
||||
# this is for testing - 'make core' builds everything that isn't generated
|
||||
add_custom_target( core )
|
||||
add_dependencies( core stepdai check-express stepeditor fedex_plus )
|
||||
|
||||
if(NOT SCL_IS_SUBBUILD)
|
||||
###############################################################################
|
||||
# SCL Packaging #
|
||||
# $make package #
|
||||
###############################################################################
|
||||
|
||||
SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "STEP Class Library")
|
||||
SET(CPACK_SET_DESTDIR "ON")
|
||||
|
||||
SET(CPACK_PACKAGE_VERSION_MAJOR ${SCL_VERSION_MAJOR})
|
||||
SET(CPACK_PACKAGE_VERSION_MINOR ${SCL_VERSION_MINOR})
|
||||
SET(CPACK_PACKAGE_NAME SCL )
|
||||
|
||||
SET(CPACK_PACKAGE_CONTACT "SCL Developers <scl-dev@googlegroups.com>")
|
||||
INCLUDE(CPack)
|
||||
|
||||
########################################################################################
|
||||
# Uninstall code #
|
||||
# From http://www.cmake.org/Wiki/CMake_FAQ#Can_I_do_.22make_uninstall.22_with_CMake.3F #
|
||||
# ######################################################################################
|
||||
configure_file(
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
|
||||
IMMEDIATE @ONLY)
|
||||
|
||||
add_custom_target(uninstall
|
||||
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
|
||||
|
||||
endif(NOT SCL_IS_SUBBUILD)
|
||||
|
||||
@@ -6,7 +6,7 @@ STEP Class Library.
|
||||
These installation requires that you have the following software
|
||||
available:
|
||||
|
||||
- C and C++ compilers (only gcc has been tested recently)
|
||||
- C and C++ compilers (Tested with GCC, MSVC, Embarcadero)
|
||||
- bison, byacc, or yacc (only bison has been tested recently)
|
||||
- flex or lex (only flex has been tested recently)
|
||||
- CMake
|
||||
@@ -21,12 +21,22 @@ Installation
|
||||
* Build system uses CMake now: configure, Makefile, and all
|
||||
autotools files have been removed, as has mkProbe.
|
||||
|
||||
* To build:
|
||||
cd scl
|
||||
mkdir build
|
||||
cd build
|
||||
cmake ..
|
||||
make
|
||||
* Building SCL from the command prompt:
|
||||
- cd scl
|
||||
- mkdir build
|
||||
- cd build
|
||||
- cmake ..
|
||||
- make
|
||||
- make install # optional
|
||||
|
||||
* Building SCL from the GUI:
|
||||
- Run cmake-gui, set it to build in scl/build
|
||||
- Select the correct build file generator
|
||||
- Press Configure
|
||||
- Change options as necessary, configuring again afterwards
|
||||
- If there are errors, some options may not be visible until the error is resolved
|
||||
- Press Generate
|
||||
- Open the main build file using your preferred build tool
|
||||
|
||||
* Build options (append to the 'cmake ..' line):
|
||||
-DBUILD_SCHEMAS="path/to/schema.exp;path/to/schema2.exp"
|
||||
@@ -45,3 +55,16 @@ Installation
|
||||
-DCMAKE_BUILD_TYPE=Release
|
||||
- this causes binaries to be built without debugging information
|
||||
- without this, cmake defaults to a Debug build
|
||||
|
||||
* Using CTest to test SCL:
|
||||
- Read the comments in run_ctest.cmake
|
||||
- (OPTIONAL) Create scl/../.SCL_CTEST_PREFS.cmake, and set variables
|
||||
in it (this file is required for CDash submission to be enabled)
|
||||
- Run tests with `ctest -S run_ctest.cmake`
|
||||
|
||||
* Using CTest to regenerate the schema matrix on the github SCL wiki:
|
||||
- Requires:
|
||||
- git
|
||||
- python
|
||||
- a clone of the git repo for the wiki at scl/../wiki-scl
|
||||
- run `ctest -S ctest_matrix.cmake`
|
||||
|
||||
@@ -1,5 +1,23 @@
|
||||
STEP Class Library ------ http://github.com/mpictor/StepClassLibrary
|
||||
************************************************************************
|
||||
Release 0.5 (Feb 23, 2012)
|
||||
|
||||
New since v0.4:
|
||||
* MSVC and Embarcadero support, along with many warning fixes
|
||||
* Experimental Python support
|
||||
* Now handles most features of EXPRESS - all included schemas,
|
||||
with the exception of AP209 CD, are parsed without error. Enums are
|
||||
now in their own dictionary. Allow indexing on aggregates, generics,
|
||||
and binaries.
|
||||
* Changes to fedex_plus that improve the generated c++ - use a
|
||||
namespace, break up large static strings, make EXPRESS multiple
|
||||
inheritance work by not printing multiple copies of inherited members.
|
||||
All schemas now compile without error, but there are numerous warnings.
|
||||
* Exchange files: handle all comments, fill in some missing attributes.
|
||||
* More cleanup of source code, more documentation in scl/doc
|
||||
* Special thanks to @davyw and @tpaviot for their large contributions
|
||||
(MSVC and Python, respectively)
|
||||
************************************************************************
|
||||
Release 0.4 (Nov 13, 2011)
|
||||
|
||||
New since v0.3:
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
***********************************************************************
|
||||
Step Class Library v0.4 -- http://github.com/mpictor/StepClassLibrary
|
||||
Step Class Library v0.5 -- http://github.com/mpictor/StepClassLibrary
|
||||
|
||||
* What is SCL? SCL reads ISO10303-11 EXPRESS schemas and generates
|
||||
C++ source code that can read and write Part 21 files conforming
|
||||
to that schema. SCL once worked with ObjectStore, OODB, and
|
||||
CORBA IDL - but that code has not been used in a very long time.
|
||||
We are in the process of removing this code because ObjectStore,
|
||||
CORBA, etc. are no longer part of the STEP standard.
|
||||
C++ source code that can read and write Part 21 files conforming
|
||||
to that schema. In addition to C++, v0.5 includes experimental
|
||||
support for Python.
|
||||
|
||||
* SCL is packaged along with some other tools. See
|
||||
"THE NIST STEP TOOLSET", below. In particular, Data Probe
|
||||
@@ -21,36 +19,7 @@ Step Class Library v0.4 -- http://github.com/mpictor/StepClassLibrary
|
||||
* Build system uses only CMake now: configure, Makefile, and all
|
||||
autotools files have been removed, as has mkProbe.
|
||||
|
||||
* To build:
|
||||
cd scl
|
||||
mkdir build
|
||||
cd build
|
||||
cmake ..
|
||||
make
|
||||
|
||||
* Build options (append to the 'cmake ..' line):
|
||||
-DBUILD_SCHEMAS="path/to/schema.exp;path/to/schema2.exp"
|
||||
- this generates c++ for the schema, and compiles it into a
|
||||
library. Also works with directories, as long as each dir only
|
||||
has one express file.
|
||||
- multiple files/directories are separated by semicolons
|
||||
- this also builds a 'p21read' program, which reads one step file
|
||||
and writes another. It may change whitespace or remove comments;
|
||||
otherwise, the input and output files should be identical. If
|
||||
they are not identical, either the file does not match the
|
||||
schema, or SCL generated incorrect source code.
|
||||
-DBUILD_SCHEMAS=ALL
|
||||
- Added to make use of ctest easier. If BUILD_SCHEMAS == ALL,
|
||||
then CMake adds each *.exp file found in data/.
|
||||
-DCMAKE_BUILD_TYPE=Release
|
||||
- this causes binaries to be built without debugging information
|
||||
- without this, cmake defaults to a Debug build
|
||||
|
||||
* Using CTest to test SCL:
|
||||
- Read the comments in run_ctest.cmake
|
||||
- (OPTIONAL) Create scl/../.SCL_CTEST_PREFS.cmake, and set variables
|
||||
in it (this file is required for CDash submission to be enabled)
|
||||
- Run tests with `ctest -S run_ctest.cmake`
|
||||
* Building and testing SCL - see the INSTALL file
|
||||
|
||||
***********************************************************************
|
||||
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
0.4
|
||||
0.5
|
||||
|
||||
@@ -151,9 +151,6 @@ IF(LEX_EXECUTABLE)
|
||||
SET(FILE_RUN_DEFINITIONS "-DYYTEXT_POINTER=1")
|
||||
CHECK_C_FILE_RUNS(${CMAKE_CURRENT_SOURCE_DIR}/cmake/test_srcs/sys_wait_test.c YYTEXT_POINTER)
|
||||
SET(FILE_RUN_DEFINITIONS)
|
||||
IF(CONFIG_H_FILE)
|
||||
FILE(APPEND ${CONFIG_H_FILE} "#cmakedefine YYTEXT_POINTER 1\n")
|
||||
ENDIF(CONFIG_H_FILE)
|
||||
|
||||
|
||||
ENDIF(LEX_EXECUTABLE)
|
||||
|
||||
@@ -33,15 +33,15 @@ MACRO(SCL_ADDLIB libname srcs libs)
|
||||
STRING(REGEX REPLACE " " ";" libslist1 "${libs}")
|
||||
STRING(REGEX REPLACE "-framework;" "-framework " libslist "${libslist1}")
|
||||
DLL_DEFINE(${libname})
|
||||
IF(BUILD_SHARED_LIBS)
|
||||
IF(SCL_BUILD_SHARED_LIBS)
|
||||
add_library(${libname} SHARED ${srcslist})
|
||||
if(NOT ${libs} MATCHES "NONE")
|
||||
target_link_libraries(${libname} ${libslist})
|
||||
endif(NOT ${libs} MATCHES "NONE")
|
||||
SET_TARGET_PROPERTIES(${libname} PROPERTIES VERSION ${SCL_VERSION_MAJOR}.${SCL_VERSION_MINOR} SOVERSION ${SCL_VERSION_MAJOR} )
|
||||
SET_TARGET_PROPERTIES(${libname} PROPERTIES VERSION ${SCL_ABI_VERSION} SOVERSION ${SCL_ABI_SOVERSION} )
|
||||
INSTALL(TARGETS ${libname} DESTINATION lib)
|
||||
ENDIF(BUILD_SHARED_LIBS)
|
||||
IF(BUILD_STATIC_LIBS AND NOT MSVC)
|
||||
ENDIF(SCL_BUILD_SHARED_LIBS)
|
||||
IF(SCL_BUILD_STATIC_LIBS AND NOT MSVC)
|
||||
add_library(${libname}-static STATIC ${srcslist})
|
||||
if(NOT ${libs} MATCHES "NONE")
|
||||
target_link_libraries(${libname}-static ${libslist})
|
||||
@@ -56,7 +56,7 @@ MACRO(SCL_ADDLIB libname srcs libs)
|
||||
SET_TARGET_PROPERTIES(${libname}-static PROPERTIES PREFIX "lib")
|
||||
ENDIF(WIN32)
|
||||
INSTALL(TARGETS ${libname}-static DESTINATION lib)
|
||||
ENDIF(BUILD_STATIC_LIBS AND NOT MSVC)
|
||||
ENDIF(SCL_BUILD_STATIC_LIBS AND NOT MSVC)
|
||||
# Enable extra compiler flags if local libraries and/or global options dictate
|
||||
SET(LOCAL_COMPILE_FLAGS "")
|
||||
FOREACH(extraarg ${ARGN})
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
if (NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
|
||||
message(FATAL_ERROR "Cannot find install manifest: \"@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt\"")
|
||||
endif(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
|
||||
|
||||
file(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files)
|
||||
string(REGEX REPLACE "\n" ";" files "${files}")
|
||||
list(REVERSE files)
|
||||
foreach (file ${files})
|
||||
message(STATUS "Uninstalling \"$ENV{DESTDIR}${file}\"")
|
||||
if (EXISTS "$ENV{DESTDIR}${file}")
|
||||
execute_process(
|
||||
COMMAND ${CMAKE_COMMAND} -E remove "$ENV{DESTDIR}${file}"
|
||||
OUTPUT_VARIABLE rm_out
|
||||
RESULT_VARIABLE rm_retval
|
||||
)
|
||||
if(NOT ${rm_retval} EQUAL 0)
|
||||
message(FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"")
|
||||
endif (NOT ${rm_retval} EQUAL 0)
|
||||
else (EXISTS "$ENV{DESTDIR}${file}")
|
||||
message(STATUS "File \"$ENV{DESTDIR}${file}\" does not exist.")
|
||||
endif (EXISTS "$ENV{DESTDIR}${file}")
|
||||
endforeach(file)
|
||||
@@ -7,6 +7,8 @@
|
||||
|
||||
#scl_version_string.h defines scl_version() which returns a pretty commit description and a build timestamp.
|
||||
|
||||
set(SCL_IS_SUBBUILD "@SCL_IS_SUBBUILD@")
|
||||
|
||||
set(VERS_FILE ${SOURCE_DIR}/SCL_VERSION.txt )
|
||||
if( EXISTS ${SOURCE_DIR}/.git )
|
||||
find_package(Git QUIET)
|
||||
@@ -14,15 +16,21 @@ if( EXISTS ${SOURCE_DIR}/.git )
|
||||
execute_process(COMMAND ${GIT_EXECUTABLE} describe --tags RESULT_VARIABLE res_var OUTPUT_VARIABLE GIT_COMMIT_ID )
|
||||
if( NOT ${res_var} EQUAL 0 )
|
||||
file( READ ${VERS_FILE} GIT_COMMIT_ID LIMIT 255 )
|
||||
message( WARNING "Git failed (probably no tags in repo). Build will contain revision info from ${VERS_FILE}." )
|
||||
if(NOT SCL_IS_SUBBUILD)
|
||||
message( WARNING "Git failed (probably no tags in repo). Build will contain revision info from ${VERS_FILE}." )
|
||||
endif(NOT SCL_IS_SUBBUILD)
|
||||
endif()
|
||||
else(GIT_FOUND)
|
||||
file( READ ${VERS_FILE} GIT_COMMIT_ID LIMIT 255 )
|
||||
message( WARNING "Git not found. Build will contain revision info from ${VERS_FILE}." )
|
||||
if(NOT SCL_IS_SUBBUILD)
|
||||
message( WARNING "Git not found. Build will contain revision info from ${VERS_FILE}." )
|
||||
endif(NOT SCL_IS_SUBBUILD)
|
||||
endif(GIT_FOUND)
|
||||
else()
|
||||
file( READ ${VERS_FILE} GIT_COMMIT_ID LIMIT 255 )
|
||||
message( WARNING "Git failed ('.git' not found). Build will contain revision info from ${VERS_FILE}." )
|
||||
if(NOT SCL_IS_SUBBUILD)
|
||||
message( WARNING "Git failed ('.git' not found). Build will contain revision info from ${VERS_FILE}." )
|
||||
endif(NOT SCL_IS_SUBBUILD)
|
||||
endif()
|
||||
|
||||
string( REPLACE "\n" "" GIT_COMMIT_ID ${GIT_COMMIT_ID} )
|
||||
@@ -30,10 +38,10 @@ string( REPLACE "\n" "" GIT_COMMIT_ID ${GIT_COMMIT_ID} )
|
||||
set( vstring "//scl_version_string.h - written by cmake. Changes will be lost!\n"
|
||||
"#ifndef SCL_VERSION_STRING\n"
|
||||
"#define SCL_VERSION_STRING\n\n"
|
||||
"/*\n** Returns a string like \"test-1-g5e1fb47, built on <timestamp>\", where test is the\n"
|
||||
"/*\n** Returns a string like \"test-1-g5e1fb47, built at TIME on DATE\", where test is the\n"
|
||||
"** name of the last tagged git revision, 1 is the number of commits since that tag,\n"
|
||||
"** 'g' is unknown, 5e1fb47 is the first 7 chars of the git sha1 commit id, and\n"
|
||||
"** <timestamp> is the output of your system's 'date' command.\n*/\n\n"
|
||||
"** 'g' is unknown, 5e1fb47 is the first 7 chars of the git sha1 commit id, and TIME\n"
|
||||
"** and DATE are substituted by the compiler.\n*/\n\n"
|
||||
"const char* scl_version() {\n"
|
||||
" return \"git commit id ${GIT_COMMIT_ID}, built at \"__TIME__\" on \"__DATE__\;\n"
|
||||
"}\n\n"
|
||||
@@ -45,4 +53,6 @@ file(WRITE scl_version_string.h.txt ${vstring} )
|
||||
# reduces needless rebuilds
|
||||
execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
||||
scl_version_string.h.txt ${BINARY_DIR}/include/scl_version_string.h)
|
||||
message("-- scl_version_string.h is up-to-date.")
|
||||
if(NOT SCL_IS_SUBBUILD)
|
||||
message("-- scl_version_string.h is up-to-date.")
|
||||
endif(NOT SCL_IS_SUBBUILD)
|
||||
|
||||
+4
-36
@@ -8,49 +8,17 @@ set( CTEST_MEMORYCHECK_COMMAND /usr/bin/valgrind )
|
||||
set( CTEST_INITIAL_CACHE "
|
||||
SITE:STRING=${CTEST_SITE}
|
||||
BUILDNAME:STRING=${CTEST_BUILD_NAME}
|
||||
ENABLE_TESTING:BOOL=ON
|
||||
CMAKE_BUILD_TYPE:STRING=Debug
|
||||
SCL_ENABLE_TESTING:BOOL=ON
|
||||
SCL_BUILD_TYPE:STRING=Debug
|
||||
")
|
||||
|
||||
# find number of processors, for faster builds
|
||||
# from http://www.kitware.com/blog/home/post/63
|
||||
if(NOT DEFINED PROCESSOR_COUNT)
|
||||
# Unknown:
|
||||
set(PROCESSOR_COUNT 0)
|
||||
|
||||
# Linux:
|
||||
set(cpuinfo_file "/proc/cpuinfo")
|
||||
if(EXISTS "${cpuinfo_file}")
|
||||
file(STRINGS "${cpuinfo_file}" procs REGEX "^processor.: [0-9]+$")
|
||||
list(LENGTH procs PROCESSOR_COUNT)
|
||||
endif()
|
||||
|
||||
# Mac:
|
||||
if(APPLE)
|
||||
find_program(cmd_sys_pro "system_profiler")
|
||||
if(cmd_sys_pro)
|
||||
execute_process(COMMAND ${cmd_sys_pro} OUTPUT_VARIABLE info)
|
||||
string(REGEX REPLACE "^.*Total Number Of Cores: ([0-9]+).*$" "\\1"
|
||||
PROCESSOR_COUNT "${info}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Windows:
|
||||
if(WIN32)
|
||||
set(PROCESSOR_COUNT "$ENV{NUMBER_OF_PROCESSORS}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set(CTEST_BUILD_FLAGS "-j${PROCESSOR_COUNT}")
|
||||
|
||||
|
||||
ctest_start(matrix)
|
||||
ctest_empty_binary_directory(${CTEST_BINARY_DIRECTORY})
|
||||
ctest_configure( BUILD "${CTEST_BINARY_DIRECTORY}" OPTIONS -DENABLE_TESTING=ON )
|
||||
ctest_configure( BUILD "${CTEST_BINARY_DIRECTORY}" OPTIONS -DSCL_ENABLE_TESTING=ON )
|
||||
ctest_build( BUILD "${CTEST_BINARY_DIRECTORY}" )
|
||||
message("running tests")
|
||||
ctest_test( BUILD "${CTEST_BINARY_DIRECTORY}" PARALLEL_LEVEL ${PROCESSOR_COUNT}
|
||||
INCLUDE_LABEL "cpp_schema_....*" )
|
||||
ctest_test( BUILD "${CTEST_BINARY_DIRECTORY}" INCLUDE_LABEL "cpp_schema_....*" )
|
||||
|
||||
message("running python script")
|
||||
execute_process( COMMAND python ../misc/wiki-scripts/update-matrix.py
|
||||
|
||||
+13
-9
@@ -2,13 +2,13 @@
|
||||
#this sets a property so that the target doesn't get built by 'make' or 'make all'
|
||||
#useful when testing generation of schema code/compiling schem libs/etc
|
||||
FUNCTION( TESTABLE_TARGET target )
|
||||
if(ENABLE_TESTING)
|
||||
if(SCL_ENABLE_TESTING)
|
||||
set_target_properties( ${target} PROPERTIES EXCLUDE_FROM_ALL ON )
|
||||
endif()
|
||||
ENDFUNCTION( TESTABLE_TARGET )
|
||||
|
||||
# To build one or more schemas, configure with
|
||||
# 'cmake -DBUILD_SCHEMAS="path/to/schema.exp;path/to/schema2.exp"
|
||||
# 'cmake -DSCL_BUILD_SCHEMAS="path/to/schema.exp;path/to/schema2.exp"
|
||||
|
||||
# This function runs fedex on one express file. The generated source goes in a dir
|
||||
# in the build dir, and it is compiled into a library. A p21read executable is
|
||||
@@ -51,7 +51,7 @@ FUNCTION(BUILD_A_SCHEMA SCHEMA_FILE)
|
||||
# multiple schemas, each one will use the include dirs from all previous schemas. Since
|
||||
# one header (schema.h) is always named the same, this will not work. only workaround
|
||||
# seems to be set_target_properties( <target> PROPERTIES COMPILE_FLAGS <flags> )
|
||||
set( ${PROJECT_NAME}_COMPILE_FLAGS "-I${CMAKE_CURRENT_SOURCE_DIR} -I${SCL_SOURCE_DIR}/src/cldai -I${SCL_SOURCE_DIR}/src/cleditor -I${SCL_SOURCE_DIR}/src/clutils -I${SCHEMA_OUTPUT_DIR} -I${SCL_SOURCE_DIR}/src/clstepcore" )
|
||||
set( ${PROJECT_NAME}_COMPILE_FLAGS "-I${CMAKE_CURRENT_SOURCE_DIR} -I${SCL_SOURCE_DIR}/src/cldai -I${SCL_SOURCE_DIR}/src/cleditor -I${SCL_SOURCE_DIR}/src/clutils -I${SCHEMA_OUTPUT_DIR} -I${SCL_SOURCE_DIR}/src/clstepcore -I${SCL_SOURCE_DIR}/src/base" )
|
||||
|
||||
add_custom_target( generate_cpp_${SCHEMA_SHORT_NAME} SOURCES ${FEDEX_OUT} )
|
||||
add_custom_command( OUTPUT ${SCHEMA_OUTPUT_DIR}
|
||||
@@ -65,17 +65,21 @@ FUNCTION(BUILD_A_SCHEMA SCHEMA_FILE)
|
||||
VERBATIM )
|
||||
if(MSVC OR BORLAND)
|
||||
add_definitions( -DSCL_SCHEMA_DLL_EXPORTS )
|
||||
add_definitions( -DSCL_BASE_DLL_IMPORTS )
|
||||
add_definitions( -DSCL_EXPRESS_DLL_IMPORTS )
|
||||
add_definitions( -DSCL_UTILS_DLL_IMPORTS )
|
||||
add_definitions( -DSCL_UTILS_DLL_IMPORTS )
|
||||
add_definitions( -DSCL_DAI_DLL_IMPORTS )
|
||||
add_definitions( -DSCL_CORE_DLL_IMPORTS )
|
||||
add_definitions( -DSCL_EDITOR_DLL_IMPORTS )
|
||||
endif()
|
||||
add_library( ${PROJECT_NAME} SHARED ${FEDEX_OUT} )
|
||||
target_link_libraries(${PROJECT_NAME} stepdai stepcore express stepeditor steputils )
|
||||
target_link_libraries(${PROJECT_NAME} stepdai stepcore express stepeditor steputils base )
|
||||
add_dependencies( ${PROJECT_NAME} generate_cpp_${SCHEMA_SHORT_NAME} )
|
||||
set_target_properties( ${PROJECT_NAME} PROPERTIES COMPILE_FLAGS
|
||||
${${PROJECT_NAME}_COMPILE_FLAGS} )
|
||||
if(APPLE)
|
||||
set_target_properties(${PROJECT_NAME} PROPERTIES LINK_FLAGS "-flat_namespace -undefined suppress")
|
||||
endif(APPLE)
|
||||
TESTABLE_TARGET( ${PROJECT_NAME} )
|
||||
|
||||
add_test( NAME generate_cpp_${SCHEMA_SHORT_NAME}
|
||||
@@ -117,11 +121,11 @@ FUNCTION(BUILD_A_SCHEMA SCHEMA_FILE)
|
||||
|
||||
ENDFUNCTION(BUILD_A_SCHEMA)
|
||||
|
||||
if( DEFINED BUILD_SCHEMAS )
|
||||
if( BUILD_SCHEMAS STREQUAL "ALL" )
|
||||
file( GLOB_RECURSE BUILD_SCHEMAS ${SCL_SOURCE_DIR}/data/*.exp )
|
||||
if( DEFINED SCL_BUILD_SCHEMAS )
|
||||
if( SCL_BUILD_SCHEMAS STREQUAL "ALL" )
|
||||
file( GLOB_RECURSE SCL_BUILD_SCHEMAS ${SCL_SOURCE_DIR}/data/*.exp )
|
||||
endif()
|
||||
foreach( ap ${BUILD_SCHEMAS} )
|
||||
foreach( ap ${SCL_BUILD_SCHEMAS} )
|
||||
BUILD_A_SCHEMA( ${ap} )
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
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
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
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
+12
-5
@@ -1,7 +1,14 @@
|
||||
SET(scl_MANS
|
||||
man/man1/dataprobe.1
|
||||
man/man1/fedex.1
|
||||
man/man1/fedex_plus.1
|
||||
man/man1/mkProbe.1
|
||||
man/man1/dataprobe.1
|
||||
man/man1/fedex.1
|
||||
man/man1/fedex_plus.1
|
||||
man/man1/mkProbe.1
|
||||
)
|
||||
INSTALL(FILES ${scl_MANS} DESTINATION ${MAN_DIR}/man1)
|
||||
|
||||
if(NOT DEFINED MAN_DIR)
|
||||
set(MAN_DIR share/man)
|
||||
endif(NOT DEFINED MAN_DIR)
|
||||
|
||||
IF(NOT WIN32)
|
||||
INSTALL(FILES ${scl_MANS} DESTINATION ${CMAKE_INSTALL_PREFIX}/${MAN_DIR}/man1)
|
||||
ENDIF(NOT WIN32)
|
||||
|
||||
Binary file not shown.
File diff suppressed because one or more lines are too long
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because one or more lines are too long
Binary file not shown.
File diff suppressed because one or more lines are too long
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because one or more lines are too long
Binary file not shown.
File diff suppressed because one or more lines are too long
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
-6105
File diff suppressed because it is too large
Load Diff
@@ -106,6 +106,7 @@ GLOBAL SCL_EXPRESS_EXPORT char DICT_type; /**< set as a side-effect of DICT loo
|
||||
/***********************/
|
||||
|
||||
extern SCL_EXPRESS_EXPORT void DICTinitialize PROTO( ( void ) );
|
||||
extern SCL_EXPRESS_EXPORT void DICTcleanup PROTO( ( void ) );
|
||||
extern SCL_EXPRESS_EXPORT int DICTdefine PROTO( ( Dictionary, char *, Generic, Symbol *, char ) );
|
||||
extern SCL_EXPRESS_EXPORT int DICT_define PROTO( ( Dictionary, char *, Generic, Symbol *, char ) );
|
||||
extern SCL_EXPRESS_EXPORT void DICTundefine PROTO( ( Dictionary, char * ) );
|
||||
|
||||
@@ -184,10 +184,12 @@ static_inline void ERRORflush_messages( void ) {
|
||||
|
||||
extern SCL_EXPRESS_EXPORT void ERRORinitialize PROTO( ( void ) );
|
||||
extern SCL_EXPRESS_EXPORT void ERRORinitialize_after_LIST PROTO( ( void ) );
|
||||
extern SCL_EXPRESS_EXPORT void ERRORcleanup PROTO( ( void ) );
|
||||
extern SCL_EXPRESS_EXPORT void ERRORnospace PROTO( ( void ) );
|
||||
extern SCL_EXPRESS_EXPORT void ERRORabort PROTO( ( int ) );
|
||||
extern SCL_EXPRESS_EXPORT Error ERRORcreate PROTO( ( char *, Severity ) );
|
||||
extern SCL_EXPRESS_EXPORT void ERRORreport PROTO( ( Error, ... ) );
|
||||
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_ *, ... ) );
|
||||
|
||||
@@ -270,6 +270,7 @@ extern SCL_EXPRESS_EXPORT Expression BIN_EXPcreate PROTO( ( Op_Code, Expressio
|
||||
extern SCL_EXPRESS_EXPORT Expression TERN_EXPcreate PROTO( ( Op_Code, Expression, Expression, Expression ) );
|
||||
extern SCL_EXPRESS_EXPORT Expression QUERYcreate PROTO( ( Symbol *, Expression ) );
|
||||
extern SCL_EXPRESS_EXPORT void EXPinitialize PROTO( ( void ) );
|
||||
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 ) );
|
||||
|
||||
|
||||
@@ -266,8 +266,10 @@ GLOBAL SCL_EXPRESS_EXPORT char * KW_XOR INITIALLY( "XOR" );
|
||||
/***********************/
|
||||
|
||||
extern SCL_EXPRESS_EXPORT Express EXPRESScreate PROTO( ( void ) );
|
||||
extern SCL_EXPRESS_EXPORT void EXPRESSdestroy PROTO( ( Express ) );
|
||||
extern SCL_EXPRESS_EXPORT void EXPRESSparse PROTO( ( Express, FILE *, char * ) );
|
||||
extern SCL_EXPRESS_EXPORT void EXPRESSinitialize PROTO( ( void ) );
|
||||
extern SCL_EXPRESS_EXPORT void EXPRESScleanup PROTO( ( void ) );
|
||||
extern SCL_EXPRESS_EXPORT void EXPRESSresolve PROTO( ( Express ) );
|
||||
extern SCL_EXPRESS_EXPORT char * EXPRESSversion PROTO( ( void ) );
|
||||
extern SCL_EXPRESS_EXPORT int EXPRESS_fail PROTO( ( Express ) );
|
||||
|
||||
@@ -135,6 +135,7 @@ GLOBAL SCL_EXPRESS_EXPORT Linked_List LINK__l; /* for LISTcreate_with macro
|
||||
/***********************/
|
||||
|
||||
extern SCL_EXPRESS_EXPORT void LISTinitialize PROTO( ( void ) );
|
||||
extern SCL_EXPRESS_EXPORT void LISTcleanup PROTO( ( void ) );
|
||||
extern SCL_EXPRESS_EXPORT Linked_List LISTcreate PROTO( ( void ) );
|
||||
extern SCL_EXPRESS_EXPORT Linked_List LISTcopy PROTO( ( Linked_List ) );
|
||||
extern SCL_EXPRESS_EXPORT Generic LISTadd_first PROTO( ( Linked_List, Generic ) );
|
||||
|
||||
@@ -108,6 +108,7 @@ GLOBAL SCL_EXPRESS_EXPORT struct Object * OBJ;
|
||||
/***********************/
|
||||
|
||||
extern SCL_EXPRESS_EXPORT void OBJinitialize PROTO( ( void ) );
|
||||
extern SCL_EXPRESS_EXPORT void OBJcleanup PROTO( ( void ) );
|
||||
extern SCL_EXPRESS_EXPORT void OBJcreate PROTO( ( char, struct Symbol_ * ( * )( Generic ), char *, int ) );
|
||||
extern SCL_EXPRESS_EXPORT Symbol * UNK_get_symbol PROTO( ( Generic x ) );
|
||||
|
||||
|
||||
@@ -65,6 +65,14 @@ GLOBAL SCL_EXPRESS_EXPORT Error ERROR_circular_reference INITIALLY( ERROR_
|
||||
GLOBAL SCL_EXPRESS_EXPORT Error ERROR_ambiguous_attribute INITIALLY( ERROR_none );
|
||||
GLOBAL SCL_EXPRESS_EXPORT Error ERROR_ambiguous_group INITIALLY( ERROR_none );
|
||||
|
||||
/** If we're inside a conditional statement (within a function, procedure, etc)
|
||||
* then this variable points to that statement. Currently the only use is to
|
||||
* suppress errors when the test in an IF...ENDIF always evaluates one way.
|
||||
* Set within STMTresolve().
|
||||
* \sa STMTresolve
|
||||
*/
|
||||
GLOBAL SCL_EXPRESS_EXPORT Statement currCondStmt INITIALLY(0);
|
||||
|
||||
#undef GLOBAL
|
||||
#undef INITIALLY
|
||||
|
||||
@@ -82,6 +90,7 @@ GLOBAL SCL_EXPRESS_EXPORT Error ERROR_ambiguous_group INITIALLY( ERROR_
|
||||
/***********************/
|
||||
|
||||
extern SCL_EXPRESS_EXPORT void RESOLVEinitialize PROTO( ( void ) );
|
||||
extern SCL_EXPRESS_EXPORT void RESOLVEcleanup PROTO( ( void ) );
|
||||
extern SCL_EXPRESS_EXPORT void SCOPEresolve_expressions_statements PROTO( ( Scope ) );
|
||||
extern SCL_EXPRESS_EXPORT void SCOPEresolve_subsupers PROTO( ( Scope ) );
|
||||
extern SCL_EXPRESS_EXPORT void SCOPEresolve_types PROTO( ( Scope ) );
|
||||
|
||||
@@ -155,6 +155,7 @@ extern SCL_EXPRESS_EXPORT Generic SCHEMAfind PROTO( ( Schema, char * name, int
|
||||
extern SCL_EXPRESS_EXPORT Scope SCOPEcreate PROTO( ( char ) );
|
||||
extern SCL_EXPRESS_EXPORT Scope SCOPEcreate_tiny PROTO( ( char ) );
|
||||
extern SCL_EXPRESS_EXPORT Scope SCOPEcreate_nostab PROTO( ( char ) );
|
||||
extern SCL_EXPRESS_EXPORT void SCOPEdestroy PROTO( ( Scope ) );
|
||||
extern SCL_EXPRESS_EXPORT Linked_List SCHEMAget_entities_use PROTO( ( Scope ) );
|
||||
extern SCL_EXPRESS_EXPORT Linked_List SCHEMAget_entities_ref PROTO( ( Scope ) );
|
||||
|
||||
|
||||
@@ -235,6 +235,8 @@ GLOBAL SCL_EXPRESS_EXPORT Error ERROR_corrupted_type INITIALLY( ERROR_none );
|
||||
#define TYPEis_identifier(t) ((t)->u.type->body->type == identifier_)
|
||||
#define TYPEis_logical(t) ((t)->u.type->body->type == logical_)
|
||||
#define TYPEis_boolean(t) ((t)->u.type->body->type == boolean_)
|
||||
#define TYPEis_real(t) ((t)->u.type->body->type == real_)
|
||||
#define TYPEis_integer(t) ((t)->u.type->body->type == integer_)
|
||||
#define TYPEis_string(t) ((t)->u.type->body->type == string_)
|
||||
#define TYPEis_expression(t) ((t)->u.type->body->type == op_)
|
||||
#define TYPEis_oneof(t) ((t)->u.type->body->type == oneof_)
|
||||
@@ -302,6 +304,7 @@ extern SCL_EXPRESS_EXPORT Type TYPEcreate_name PROTO( ( struct Symbol_ * ) );
|
||||
extern SCL_EXPRESS_EXPORT Type TYPEcreate_nostab PROTO( ( struct Symbol_ *, Scope, char ) );
|
||||
extern SCL_EXPRESS_EXPORT TypeBody TYPEBODYcreate PROTO( ( enum type_enum ) );
|
||||
extern SCL_EXPRESS_EXPORT void TYPEinitialize PROTO( ( void ) );
|
||||
extern SCL_EXPRESS_EXPORT void TYPEcleanup PROTO( ( void ) );
|
||||
|
||||
extern SCL_EXPRESS_EXPORT bool TYPEinherits_from PROTO( ( Type, enum type_enum ) );
|
||||
extern SCL_EXPRESS_EXPORT Type TYPEget_nonaggregate_base_type PROTO( ( Type ) );
|
||||
|
||||
@@ -13,6 +13,10 @@
|
||||
#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
|
||||
|
||||
#cmakedefine HAVE_ABS 1
|
||||
#cmakedefine HAVE_MEMCPY 1
|
||||
#cmakedefine HAVE_MEMMOVE 1
|
||||
@@ -20,4 +24,6 @@
|
||||
|
||||
#cmakedefine HAVE_SSIZE_T 1
|
||||
|
||||
#cmakedefine HAVE_STD_THREAD 1
|
||||
|
||||
#endif /* SCL_CF_H */
|
||||
|
||||
@@ -1,6 +1,19 @@
|
||||
#ifndef SCL_EXPORT_H
|
||||
#define SCL_EXPORT_H
|
||||
|
||||
/* Import/Export flags for base. */
|
||||
#ifndef SCL_BASE_EXPORT
|
||||
# if defined(SCL_BASE_DLL_EXPORTS) && defined(SCL_BASE_DLL_IMPORTS)
|
||||
# error "Only SCL_BASE_DLL_EXPORTS or SCL_BASE_DLL_IMPORTS can be defined, not both."
|
||||
# elif defined(SCL_BASE_DLL_EXPORTS)
|
||||
# define SCL_BASE_EXPORT __declspec(dllexport)
|
||||
# elif defined(SCL_BASE_DLL_IMPORTS)
|
||||
# define SCL_BASE_EXPORT __declspec(dllimport)
|
||||
# else
|
||||
# define SCL_BASE_EXPORT
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* Import/Export flags for express. */
|
||||
#ifndef SCL_EXPRESS_EXPORT
|
||||
# if defined(SCL_EXPRESS_DLL_EXPORTS) && defined(SCL_EXPRESS_DLL_IMPORTS)
|
||||
|
||||
@@ -0,0 +1,229 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE language SYSTEM "language.dtd">
|
||||
<!--
|
||||
EXPRESS syntax definition based on sql-mysql.xml by Shane Wright (me@shanewright.co.uk)
|
||||
|
||||
This is for Kate, the KDE editor. Rename to express.xml and place in the syntax directory (on Debian, this is /usr/share/kde4/apps/katepart/syntax )
|
||||
-->
|
||||
<language name="EXPRESS" version="0.1" kateversion="2.5" section="Database" extensions="*.exp;*.EXP;*.p11" mimetype="text/x-express" casesensitive="0" author="Mark Pictor (mpictor@gmail.com)" license="">
|
||||
<highlighting>
|
||||
<list name="keywords">
|
||||
<item> of </item>
|
||||
<item> or </item>
|
||||
<item> to </item>
|
||||
<item> where </item>
|
||||
<item> subtype </item>
|
||||
<item> supertype </item>
|
||||
<item> abstract </item>
|
||||
<item> oneof </item>
|
||||
<item> not </item>
|
||||
<item> in </item>
|
||||
<item> and </item>
|
||||
<item> return </item>
|
||||
<item> then </item>
|
||||
<item> derive </item>
|
||||
<item> optional </item>
|
||||
<!-- put SCHEMA and END_SCHEMA here so code folding will fold
|
||||
everything in a schema, and not collapse the schema itself -->
|
||||
<item> schema </item>
|
||||
<item> end_schema </item>
|
||||
</list>
|
||||
<list name="kw_begin"> <!-- kw's that can begin a foldable region -->
|
||||
<item> type </item>
|
||||
<item> entity </item>
|
||||
<item> function </item>
|
||||
<item> rule </item>
|
||||
<item> constant </item>
|
||||
<item> if </item>
|
||||
<item> local </item>
|
||||
<item> repeat </item>
|
||||
<item> begin </item>
|
||||
<item> case </item>
|
||||
</list>
|
||||
<list name="kw_end"> <!-- kw's that can end a foldable region -->
|
||||
<item> end </item>
|
||||
<item> end_type </item>
|
||||
<item> end_entity </item>
|
||||
<item> end_function </item>
|
||||
<item> end_rule </item>
|
||||
<item> end_constant </item>
|
||||
<item> end_if </item>
|
||||
<item> end_local </item>
|
||||
<item> end_repeat </item>
|
||||
<item> end_case </item>
|
||||
</list>
|
||||
<list name="kw_end_begin"> <!-- end one foldable region, begin another -->
|
||||
<item> else </item>
|
||||
</list>
|
||||
<list name="interface_specification"> <!-- USE FROM, REFERENCE FROM -->
|
||||
<item> use </item>
|
||||
<item> reference </item>
|
||||
</list>
|
||||
|
||||
<list name="operators">
|
||||
<item> : </item>
|
||||
<item> , </item>
|
||||
<item> || </item>
|
||||
<item> . </item>
|
||||
<item> = </item>
|
||||
<item> ** </item>
|
||||
<item> | </item>
|
||||
<item> <* </item>
|
||||
<item> >= </item>
|
||||
<item> > </item>
|
||||
<item> :=: </item>
|
||||
<item> :<>: </item>
|
||||
<item> [ </item>
|
||||
<item> { </item>
|
||||
<item> ( </item>
|
||||
<item> <= </item>
|
||||
<item> < </item>
|
||||
<item> - </item>
|
||||
<item> <> </item>
|
||||
<item> + </item>
|
||||
<item> / </item>
|
||||
<item> ] </item>
|
||||
<item> } </item>
|
||||
<item> ) </item>
|
||||
<item> * </item>
|
||||
<item> \\ </item>
|
||||
</list>
|
||||
<list name="functions">
|
||||
<item> ABS </item>
|
||||
<item> ACOS </item>
|
||||
<item> ASIN </item>
|
||||
<item> ATAN </item>
|
||||
<item> BLENGTH </item>
|
||||
<item> COS </item>
|
||||
<item> EXISTS </item>
|
||||
<item> EXP </item>
|
||||
<item> FORMAT </item>
|
||||
<item> HIBOUND </item>
|
||||
<item> HIINDEX </item>
|
||||
<item> LENGTH </item>
|
||||
<item> LOBOUND </item>
|
||||
<item> LOINDEX </item>
|
||||
<item> LOG </item>
|
||||
<item> LOG2 </item>
|
||||
<item> LOG10 </item>
|
||||
<item> NVL </item>
|
||||
<item> ODD </item>
|
||||
<item> ROLESOF </item>
|
||||
<item> SIN </item>
|
||||
<item> SIZEOF </item>
|
||||
<item> SQRT </item>
|
||||
<item> TAN </item>
|
||||
<item> TYPEOF </item>
|
||||
<item> USEDIN </item>
|
||||
<item> VALUE </item>
|
||||
<item> VALUE_IN </item>
|
||||
<item> VALUE_UNIQUE </item>
|
||||
<item> QUERY </item>
|
||||
</list>
|
||||
<list name="constants">
|
||||
<item> CONST_E </item>
|
||||
<item> PI </item>
|
||||
<item> SELF </item>
|
||||
<!-- <item> ? </item> -->
|
||||
</list>
|
||||
<list name="types">
|
||||
<item> binary </item>
|
||||
<item> boolean </item>
|
||||
<item> integer </item>
|
||||
<item> logical </item>
|
||||
<item> number </item>
|
||||
<item> real </item>
|
||||
<item> string </item>
|
||||
<item> enumeration </item>
|
||||
<item> select </item>
|
||||
<item> array </item>
|
||||
<item> list </item>
|
||||
<item> bag </item>
|
||||
<item> set </item>
|
||||
<item> generic </item>
|
||||
</list>
|
||||
<contexts>
|
||||
<context name="Normal" attribute="Normal Text" lineEndContext="#stay">
|
||||
<DetectSpaces />
|
||||
<!-- Make code folding work for SCHEMA/END_SCHEMA, TYPE/END_TYPE, etc -->
|
||||
<!-- <RegExpr attribute="Block" context="#stay" String="(?:^|[^\w'])(?:SCHEMA|TYPE|ENTITY|FUNCTION|RULE|CONSTANT|IF|LOCAL|REPEAT|BEGIN)" insensitive="false" beginRegion="Blk" firstNonSpace="false" /> -->
|
||||
<!-- <RegExpr attribute="Block" context="#stay" String="END_(?:SCHEMA|TYPE|ENTITY|FUNCTION|RULE|CONSTANT|IF|LOCAL|REPEAT)" insensitive="false" endRegion="Blk" firstNonSpace="false" /> -->
|
||||
<!-- <RegExpr attribute="Block" context="#stay" String="END(?:[^_]|$)" endRegion="Blk" firstNonSpace="false" /> -->
|
||||
<!-- <RegExpr attribute="Block" context="#stay" String="(?:^|[^\w])ELSE(?:$|[^\w])" endRegion="Blk" beginRegion="Blk" firstNonSpace="false" /> -->
|
||||
|
||||
<!-- using the lists -->
|
||||
<keyword attribute="Keyword" context="#stay" String="keywords"/>
|
||||
<keyword attribute="Keyword" context="#stay" String="kw_begin" beginRegion="Blk" firstNonSpace="false"/>
|
||||
<keyword attribute="Keyword" context="#stay" String="kw_end_begin" endRegion="Blk" beginRegion="Blk" firstNonSpace="false" />
|
||||
<keyword attribute="Keyword" context="#stay" String="kw_end" endRegion="Blk" firstNonSpace="false"/>
|
||||
|
||||
<keyword attribute="Operator" context="#stay" String="operators"/>
|
||||
<keyword attribute="Function" context="#stay" String="functions"/>
|
||||
<keyword attribute="Constants" context="#stay" String="constants"/>
|
||||
<keyword attribute="Data Type" context="#stay" String="types"/>
|
||||
|
||||
<keyword attribute="Interface Specification" context="Interface Specification" String="interface_specification" firstNonSpace="true" />
|
||||
|
||||
<DetectIdentifier />
|
||||
<!-- extra data types -->
|
||||
<!-- numbers -->
|
||||
<HlCHex attribute="Hex" context="#stay"/>
|
||||
<Float attribute="Float" context="#stay"/>
|
||||
<Int attribute="Decimal" context="#stay"/>
|
||||
<!-- strings -->
|
||||
<DetectChar attribute="String" context="String" char="'"/>
|
||||
<DetectChar attribute="String" context="String2" char="""/>
|
||||
<!-- comments -->
|
||||
<Detect2Chars attribute="Comment" context="SingleLineComment" char="-" char1="-"/>
|
||||
<Detect2Chars attribute="Comment" context="MultiLineComment" char="(" char1="*" beginRegion="Comment"/>
|
||||
|
||||
<DetectChar attribute="Constants" context="#stay" char="?"/>
|
||||
</context>
|
||||
<!-- 'string' -->
|
||||
<context name="String" attribute="String" lineEndContext="#stay">
|
||||
<LineContinue attribute="String" context="#pop"/>
|
||||
<DetectChar attribute="String" context="#pop" char="'"/>
|
||||
</context>
|
||||
<!-- "string", extra context needed to enable "str'ing" and 'str"ing' -->
|
||||
<context name="String2" attribute="String" lineEndContext="#stay">
|
||||
<LineContinue attribute="String" context="#pop"/>
|
||||
<HlCStringChar attribute="String Char" context="#stay"/>
|
||||
<DetectChar attribute="String" context="#pop" char="""/>
|
||||
</context>
|
||||
<!-- comments -->
|
||||
<context name="SingleLineComment" attribute="Comment" lineEndContext="#pop"/>
|
||||
<context name="MultiLineComment" attribute="Comment" lineEndContext="#stay">
|
||||
<Detect2Chars attribute="Comment" context="#pop" char="*" char1=")" endRegion="Comment" />
|
||||
</context>
|
||||
<context name="Interface Specification" attribute="Interface Specification" >
|
||||
<!-- lineEndContext="#pop" -->
|
||||
<DetectChar attribute="Interface Specification" context="#pop" char=";"/>
|
||||
</context>
|
||||
</contexts>
|
||||
<itemDatas>
|
||||
<itemData name="Normal Text" defStyleNum="dsNormal" spellChecking="false"/>
|
||||
<itemData name="Keyword" defStyleNum="dsKeyword" spellChecking="false"/>
|
||||
<itemData name="Block" defStyleNum="dsKeyword" spellChecking="false"/>
|
||||
<itemData name="Operator" defStyleNum="dsNormal" spellChecking="false"/>
|
||||
<itemData name="Function" defStyleNum="dsFunction" spellChecking="false"/>
|
||||
<itemData name="Constants" defStyleNum="dsOthers" spellChecking="false"/>
|
||||
<itemData name="Data Type" defStyleNum="dsDataType" spellChecking="false"/>
|
||||
<itemData name="Decimal" defStyleNum="dsDecVal" spellChecking="false"/>
|
||||
<itemData name="Float" defStyleNum="dsFloat" spellChecking="false"/>
|
||||
<itemData name="Hex" defStyleNum="dsBaseN" spellChecking="false"/>
|
||||
<itemData name="String" defStyleNum="dsString"/>
|
||||
<itemData name="String Char" defStyleNum="dsChar" spellChecking="false"/>
|
||||
<itemData name="Comment" defStyleNum="dsComment"/>
|
||||
<itemData name="Interface Specification" defStyleNum="dsOthers" spellChecking="false"/>
|
||||
</itemDatas>
|
||||
</highlighting>
|
||||
<general>
|
||||
<comments>
|
||||
<comment name="singleLine" start="--"/>
|
||||
<comment name="multiLine" start="(*" end="*)"/>
|
||||
</comments>
|
||||
<keywords casesensitive="0" additionalDeliminator="'" />
|
||||
<!-- weakDeliminator="+-*/|=!<>~^:." -->
|
||||
</general>
|
||||
</language>
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
<NotepadPlus>
|
||||
<UserLang name="Express Schema" ext="exp">
|
||||
<Settings>
|
||||
<Global caseIgnored="yes" />
|
||||
<TreatAsSymbol comment="no" commentLine="no" />
|
||||
<Prefix words1="no" words2="no" words3="no" words4="no" />
|
||||
</Settings>
|
||||
<KeywordLists>
|
||||
<Keywords name="Delimiters">000000</Keywords>
|
||||
<Keywords name="Folder+">type entity function rule constant if local repeat begin case else</Keywords>
|
||||
<Keywords name="Folder-">end_type end_entity end_function end_rule end_constant end_if end_local end_repeat end end_base else</Keywords>
|
||||
<Keywords name="Operators">" , . / : ; [ \ ] { | } < = ></Keywords>
|
||||
<Keywords name="Comment"> 1(* 2*) 0--</Keywords>
|
||||
<Keywords name="Words1">of or to where subtype supertype abstract oneof not in and return then derive optional schema end_schema</Keywords>
|
||||
<Keywords name="Words2">abs acos asin atan blength cos exists exp format hibound hiindex length lobound loindex log log2 log10 nvl odd rolesof sin sizeof sqrt tan typeof usedin value value_in value_unique query</Keywords>
|
||||
<Keywords name="Words3">const_e pi self</Keywords>
|
||||
<Keywords name="Words4">binary boolean integer logical number real string enumeration select array list bag set generic</Keywords>
|
||||
</KeywordLists>
|
||||
<Styles>
|
||||
<WordsStyle name="DEFAULT" styleID="11" fgColor="000000" bgColor="FFFFFF" fontStyle="0" />
|
||||
<WordsStyle name="FOLDEROPEN" styleID="12" fgColor="800000" bgColor="FFFFFF" fontStyle="0" />
|
||||
<WordsStyle name="FOLDERCLOSE" styleID="13" fgColor="800000" bgColor="FFFFFF" fontStyle="0" />
|
||||
<WordsStyle name="KEYWORD1" styleID="5" fgColor="800000" bgColor="FFFFFF" fontStyle="0" />
|
||||
<WordsStyle name="KEYWORD2" styleID="6" fgColor="800000" bgColor="FFFFFF" fontStyle="0" />
|
||||
<WordsStyle name="KEYWORD3" styleID="7" fgColor="FF8000" bgColor="FFFFFF" fontStyle="0" />
|
||||
<WordsStyle name="KEYWORD4" styleID="8" fgColor="0000FF" bgColor="FFFFFF" fontStyle="0" />
|
||||
<WordsStyle name="COMMENT" styleID="1" fgColor="008000" bgColor="FFFFFF" fontStyle="0" />
|
||||
<WordsStyle name="COMMENT LINE" styleID="2" fgColor="008000" bgColor="FFFFFF" fontStyle="0" />
|
||||
<WordsStyle name="NUMBER" styleID="4" fgColor="000000" bgColor="FFFFFF" fontStyle="0" />
|
||||
<WordsStyle name="OPERATOR" styleID="10" fgColor="FF0000" bgColor="FFFFFF" fontStyle="0" />
|
||||
<WordsStyle name="DELIMINER1" styleID="14" fgColor="000000" bgColor="FFFFFF" fontStyle="0" />
|
||||
<WordsStyle name="DELIMINER2" styleID="15" fgColor="000000" bgColor="FFFFFF" fontStyle="0" />
|
||||
<WordsStyle name="DELIMINER3" styleID="16" fgColor="000000" bgColor="FFFFFF" fontStyle="0" />
|
||||
</Styles>
|
||||
</UserLang>
|
||||
</NotepadPlus>
|
||||
+21
-42
@@ -8,8 +8,8 @@ set( CTEST_MEMORYCHECK_COMMAND /usr/bin/valgrind )
|
||||
set( CTEST_INITIAL_CACHE "
|
||||
SITE:STRING=${CTEST_SITE}
|
||||
BUILDNAME:STRING=${CTEST_BUILD_NAME}
|
||||
ENABLE_TESTING:BOOL=ON
|
||||
CMAKE_BUILD_TYPE:STRING=Debug
|
||||
SCL_ENABLE_TESTING:BOOL=ON
|
||||
SCL_BUILD_TYPE:STRING=Debug
|
||||
")
|
||||
|
||||
|
||||
@@ -50,38 +50,6 @@ function( SUBMIT_TEST part )
|
||||
endif()
|
||||
endfunction( SUBMIT_TEST part )
|
||||
|
||||
# find number of processors, for faster builds
|
||||
# from http://www.kitware.com/blog/home/post/63
|
||||
if(NOT DEFINED PROCESSOR_COUNT)
|
||||
# Unknown:
|
||||
set(PROCESSOR_COUNT 0)
|
||||
|
||||
# Linux:
|
||||
set(cpuinfo_file "/proc/cpuinfo")
|
||||
if(EXISTS "${cpuinfo_file}")
|
||||
file(STRINGS "${cpuinfo_file}" procs REGEX "^processor.: [0-9]+$")
|
||||
list(LENGTH procs PROCESSOR_COUNT)
|
||||
endif()
|
||||
|
||||
# Mac:
|
||||
if(APPLE)
|
||||
find_program(cmd_sys_pro "system_profiler")
|
||||
if(cmd_sys_pro)
|
||||
execute_process(COMMAND ${cmd_sys_pro} OUTPUT_VARIABLE info)
|
||||
string(REGEX REPLACE "^.*Total Number Of Cores: ([0-9]+).*$" "\\1"
|
||||
PROCESSOR_COUNT "${info}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Windows:
|
||||
if(WIN32)
|
||||
set(PROCESSOR_COUNT "$ENV{NUMBER_OF_PROCESSORS}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set(CTEST_BUILD_FLAGS "-j${PROCESSOR_COUNT}")
|
||||
|
||||
|
||||
######################################################
|
||||
##### To disable reporting of a set of tests, comment
|
||||
##### out the SUBMIT_TEST line immediately following
|
||||
@@ -94,29 +62,33 @@ set(CTEST_BUILD_FLAGS "-j${PROCESSOR_COUNT}")
|
||||
ctest_start(Experimental)
|
||||
ctest_empty_binary_directory(${CTEST_BINARY_DIRECTORY})
|
||||
|
||||
ctest_configure( BUILD "${CTEST_BINARY_DIRECTORY}" APPEND OPTIONS -DENABLE_TESTING=ON )
|
||||
file(WRITE "${CTEST_BINARY_DIRECTORY}/CTestCustom.cmake" "
|
||||
set( CTEST_CUSTOM_ERROR_EXCEPTION \"{standard input}:[0-9][0-9]*: WARNING: \")
|
||||
")
|
||||
|
||||
ctest_configure( BUILD "${CTEST_BINARY_DIRECTORY}" APPEND OPTIONS -DSCL_ENABLE_TESTING=ON )
|
||||
SUBMIT_TEST( Configure )
|
||||
ctest_build( BUILD "${CTEST_BINARY_DIRECTORY}" APPEND )
|
||||
SUBMIT_TEST( Build )
|
||||
# ctest_memcheck( BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res PARALLEL_LEVEL ${PROCESSOR_COUNT} )
|
||||
# ctest_memcheck( BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res )
|
||||
|
||||
if(NOT SKIP_TEST_UNITARY_SCHEMAS )
|
||||
ctest_test( BUILD "${CTEST_BINARY_DIRECTORY}" APPEND
|
||||
PARALLEL_LEVEL ${PROCESSOR_COUNT} INCLUDE_LABEL "unitary_schemas" )
|
||||
INCLUDE_LABEL "unitary_schemas" )
|
||||
SUBMIT_TEST( Test )
|
||||
endif()
|
||||
|
||||
if(NOT SKIP_CPP_TEST_SCHEMA_GEN )
|
||||
ctest_test( BUILD "${CTEST_BINARY_DIRECTORY}" APPEND
|
||||
PARALLEL_LEVEL ${PROCESSOR_COUNT} INCLUDE_LABEL "cpp_schema_gen" )
|
||||
INCLUDE_LABEL "cpp_schema_gen" )
|
||||
SUBMIT_TEST( Test )
|
||||
if(NOT SKIP_CPP_TEST_SCHEMA_BUILD )
|
||||
ctest_test( BUILD "${CTEST_BINARY_DIRECTORY}" APPEND
|
||||
PARALLEL_LEVEL ${PROCESSOR_COUNT} INCLUDE_LABEL "cpp_schema_build" )
|
||||
INCLUDE_LABEL "cpp_schema_build" )
|
||||
SUBMIT_TEST( Test )
|
||||
if(NOT SKIP_CPP_TEST_SCHEMA_RW )
|
||||
ctest_test( BUILD "${CTEST_BINARY_DIRECTORY}" APPEND
|
||||
PARALLEL_LEVEL ${PROCESSOR_COUNT} INCLUDE_LABEL "cpp_schema_rw" )
|
||||
INCLUDE_LABEL "cpp_schema_rw" )
|
||||
SUBMIT_TEST( Test )
|
||||
endif()
|
||||
endif()
|
||||
@@ -125,12 +97,19 @@ endif()
|
||||
if(NOT SKIP_TEST_EXCHANGE_FILE )
|
||||
if( SKIP_CPP_TEST_SCHEMA_BUILD )
|
||||
ctest_test( BUILD "${CTEST_BINARY_DIRECTORY}" APPEND
|
||||
PARALLEL_LEVEL ${PROCESSOR_COUNT} INCLUDE "build_cpp_sdai_AP214E3_2010" )
|
||||
INCLUDE "build_cpp_sdai_AP214E3_2010" )
|
||||
SUBMIT_TEST( Test )
|
||||
endif()
|
||||
ctest_test( BUILD "${CTEST_BINARY_DIRECTORY}" APPEND
|
||||
PARALLEL_LEVEL ${PROCESSOR_COUNT} INCLUDE_LABEL "exchange_file" )
|
||||
INCLUDE_LABEL "exchange_file" )
|
||||
SUBMIT_TEST( Test )
|
||||
endif()
|
||||
|
||||
if(NOT SKIP_TEST_CPP_SCHEMA_SPECIFIC )
|
||||
ctest_test( BUILD "${CTEST_BINARY_DIRECTORY}" APPEND
|
||||
INCLUDE_LABEL "cpp_schema_specific" )
|
||||
SUBMIT_TEST( Test )
|
||||
endif()
|
||||
|
||||
|
||||
# ctest_coverage( )
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
|
||||
set(SCL_BASE_SOURCES
|
||||
scl_memmgr.cc
|
||||
scl_trace_fprintf.c
|
||||
)
|
||||
|
||||
include_directories(
|
||||
${SCL_SOURCE_DIR}/include
|
||||
)
|
||||
|
||||
if(MSVC OR BORLAND)
|
||||
add_definitions( -DSCL_BASE_DLL_EXPORTS )
|
||||
endif()
|
||||
|
||||
SCL_ADDLIB(base "${SCL_BASE_SOURCES}" "")
|
||||
@@ -0,0 +1,408 @@
|
||||
|
||||
#define SCL_MEMMGR_CC
|
||||
|
||||
#include <scl_cf.h>
|
||||
#include "scl_memmgr.h"
|
||||
|
||||
#if __APPLE__
|
||||
# include <malloc/malloc.h>
|
||||
#else
|
||||
# include <malloc.h>
|
||||
#endif
|
||||
#include <stdio.h>
|
||||
|
||||
#include <string>
|
||||
#include <set>
|
||||
|
||||
#ifdef SCL_MEMMGR_ENABLE_CHECKS
|
||||
|
||||
/**
|
||||
scl_memmgr_error definition
|
||||
*/
|
||||
class scl_memmgr_error {
|
||||
private:
|
||||
std::string _srcfile;
|
||||
unsigned int _srcline;
|
||||
unsigned int _occurences;
|
||||
public:
|
||||
scl_memmgr_error( const std::string &file, const unsigned int line );
|
||||
scl_memmgr_error( const scl_memmgr_error &rhs );
|
||||
~scl_memmgr_error( void );
|
||||
|
||||
bool operator<( const scl_memmgr_error &rhs ) const;
|
||||
|
||||
std::string getsrcfile( void ) const;
|
||||
unsigned int getsrcline( void ) const;
|
||||
unsigned int getoccurences( void ) const;
|
||||
};
|
||||
|
||||
typedef std::set<scl_memmgr_error> scl_memmgr_errors;
|
||||
typedef std::set<scl_memmgr_error>::iterator scl_memmgr_error_iterator;
|
||||
|
||||
/**
|
||||
scl_memmgr_record definition
|
||||
*/
|
||||
class scl_memmgr_record {
|
||||
private:
|
||||
void * _addr;
|
||||
size_t _size;
|
||||
std::string _srcfile;
|
||||
unsigned int _srcline;
|
||||
public:
|
||||
scl_memmgr_record( void * addr, size_t size, const char *file, const unsigned int line );
|
||||
scl_memmgr_record( void * addr );
|
||||
scl_memmgr_record( const scl_memmgr_record &rhs );
|
||||
~scl_memmgr_record( void );
|
||||
|
||||
bool operator<( const scl_memmgr_record &rhs ) const;
|
||||
|
||||
void * getaddr( void ) const;
|
||||
size_t getsize( void ) const;
|
||||
std::string getsrcfile( void ) const;
|
||||
unsigned int getsrcline( void ) const;
|
||||
};
|
||||
|
||||
typedef std::set<scl_memmgr_record> scl_memmgr_records;
|
||||
typedef std::set<scl_memmgr_record>::iterator scl_memmgr_record_iterator;
|
||||
|
||||
#endif /* SCL_MEMMGR_ENABLE_CHECKS */
|
||||
|
||||
/**
|
||||
scl_memmgr definition
|
||||
*/
|
||||
class scl_memmgr {
|
||||
private:
|
||||
#ifdef SCL_MEMMGR_ENABLE_CHECKS
|
||||
bool _record_insert_busy, _record_erase_busy;
|
||||
// memory allocation/reallocation records, inserted at allocation, erased at deallocation.
|
||||
scl_memmgr_records _records;
|
||||
// memory stats
|
||||
unsigned int _allocated; // amount of memory allocated simultaniously
|
||||
unsigned int _maximum_allocated; // maximum amount of memory allocated simultaniously
|
||||
unsigned int _allocated_total; // total amount of memory allocated in bytes
|
||||
unsigned int _reallocated_total; // total amount of memory reallocated in bytes
|
||||
unsigned int _deallocated_total; // total amount of memory deallocated in bytes
|
||||
#endif /* SCL_MEMMGR_ENABLE_CHECKS */
|
||||
protected:
|
||||
public:
|
||||
scl_memmgr(void);
|
||||
~scl_memmgr(void);
|
||||
|
||||
void * allocate( size_t size, const char *file, const int line );
|
||||
void * reallocate( void * addr, size_t size, const char *file, const int line );
|
||||
void deallocate( void * addr, const char *file, const int line );
|
||||
};
|
||||
|
||||
/**
|
||||
scl_memmgr instance.
|
||||
There should be one static instance of memmgr.
|
||||
This instance is automatically destroyed when application exits, so this allows us to add
|
||||
memory leak detection in it's destructor.
|
||||
*/
|
||||
scl_memmgr memmgr;
|
||||
|
||||
/**
|
||||
c memory functions implementation
|
||||
*/
|
||||
extern "C" {
|
||||
|
||||
void * scl_malloc_fn( unsigned int size, const char * file, const int line ) {
|
||||
return memmgr.allocate(size, file, line);
|
||||
}
|
||||
|
||||
void * scl_calloc_fn( unsigned int count, unsigned int size, const char * file, const int line ) {
|
||||
return memmgr.allocate(count * size, file, line);
|
||||
}
|
||||
|
||||
void * scl_realloc_fn( void * addr, unsigned int size, const char * file, const int line ) {
|
||||
return memmgr.reallocate(addr, size, file, line);
|
||||
}
|
||||
|
||||
void scl_free_fn( void * addr ) {
|
||||
memmgr.deallocate(addr, "", 0);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
c++ memory operators implementation
|
||||
*/
|
||||
void * scl_operator_new( size_t size, const char * file, const int line ) {
|
||||
return memmgr.allocate(size, file, line);
|
||||
}
|
||||
|
||||
void scl_operator_delete( void * addr, const char * file, const int line ) {
|
||||
memmgr.deallocate(addr, file, line);
|
||||
}
|
||||
|
||||
void scl_operator_delete( void * addr ) {
|
||||
memmgr.deallocate(addr, "", 0);
|
||||
}
|
||||
|
||||
/**
|
||||
scl_memmgr implementation
|
||||
*/
|
||||
scl_memmgr::scl_memmgr(void) {
|
||||
#ifdef SCL_MEMMGR_ENABLE_CHECKS
|
||||
_record_insert_busy = false;
|
||||
_record_erase_busy = false;
|
||||
|
||||
_allocated = 0;
|
||||
_maximum_allocated = 0;
|
||||
_allocated_total = 0;
|
||||
_reallocated_total = 0;
|
||||
_deallocated_total = 0;
|
||||
#endif /* SCL_MEMMGR_ENABLE_CHECKS */
|
||||
}
|
||||
|
||||
/**
|
||||
Destructor:
|
||||
scl_memmgr::~scl_memmgr(void)
|
||||
Description:
|
||||
The scl_memmgr destructor is used to check for memory leaks when enabled.
|
||||
All records still present when scl_memmgr instance is destroyed can be considered as
|
||||
memory leaks.
|
||||
*/
|
||||
scl_memmgr::~scl_memmgr(void) {
|
||||
#ifdef SCL_MEMMGR_ENABLE_CHECKS
|
||||
scl_memmgr_record_iterator irecord;
|
||||
scl_memmgr_errors errors;
|
||||
scl_memmgr_error_iterator ierror;
|
||||
|
||||
// Check if total allocated equals total deallocated
|
||||
if (_allocated_total != _deallocated_total) {
|
||||
// todo: generate warning for possible memory leaks, enable full memory leak checking
|
||||
printf("scl_memmgr warning: Possible memory leaks detected (%d of %d bytes)\n", _allocated_total - _deallocated_total, _allocated_total);
|
||||
}
|
||||
|
||||
// Compact leaks into an error list to prevent same leak being reported multiple times.
|
||||
_record_insert_busy = true;
|
||||
_record_erase_busy = true;
|
||||
for (irecord = _records.begin();
|
||||
irecord != _records.end();
|
||||
irecord ++) {
|
||||
scl_memmgr_error error(irecord->getsrcfile(), irecord->getsrcline());
|
||||
ierror = errors.find(error);
|
||||
if (ierror == errors.end())
|
||||
errors.insert(error);
|
||||
//else
|
||||
// ierror->occurences ++;
|
||||
}
|
||||
_record_insert_busy = false;
|
||||
_record_erase_busy = false;
|
||||
|
||||
// Loop through memory leaks to generate/buffer errors
|
||||
for (ierror = errors.begin();
|
||||
ierror != errors.end();
|
||||
ierror ++) {
|
||||
// todo: generate error for memory leak
|
||||
printf("scl_memmgr warning: Possible memory leak in %s line %d\n", ierror->getsrcfile().c_str(), ierror->getsrcline());
|
||||
}
|
||||
|
||||
// Clear remaining records
|
||||
_record_erase_busy = true;
|
||||
_records.clear();
|
||||
errors.clear();
|
||||
_record_erase_busy = false;
|
||||
#endif /* SCL_MEMMGR_ENABLE_CHECKS */
|
||||
}
|
||||
|
||||
void * scl_memmgr::allocate( size_t size, const char *file, const int line ) {
|
||||
void * addr;
|
||||
|
||||
// Allocate
|
||||
addr = malloc(size);
|
||||
if (addr == NULL) {
|
||||
// todo: error allocation failed
|
||||
printf("scl_memmgr error: Memory allocation failed in %s line %d\n", file, line);
|
||||
}
|
||||
|
||||
// Some stl implementations (for example debian gcc) use the new operator to construct
|
||||
// new elements when inserting scl_memmgr_record. When this our new operator gets used
|
||||
// for this operation, this would result in an infinite loop. This is fixed by the
|
||||
// _record_insert_busy flag.
|
||||
#ifdef SCL_MEMMGR_ENABLE_CHECKS
|
||||
if (!_record_insert_busy)
|
||||
{
|
||||
// Store record for this allocation
|
||||
_record_insert_busy = true;
|
||||
_records.insert(scl_memmgr_record(addr, size, file, line));
|
||||
_record_insert_busy = false;
|
||||
|
||||
// Update stats
|
||||
_allocated += size;
|
||||
if (_allocated > _maximum_allocated)
|
||||
_maximum_allocated = _allocated;
|
||||
_allocated_total += size;
|
||||
}
|
||||
#endif /* SCL_MEMMGR_ENABLE_CHECKS */
|
||||
|
||||
return addr;
|
||||
}
|
||||
|
||||
void * scl_memmgr::reallocate( void * addr, size_t size, const char *file, const int line ) {
|
||||
#ifdef SCL_MEMMGR_ENABLE_CHECKS
|
||||
scl_memmgr_record_iterator record;
|
||||
|
||||
if (!_record_insert_busy)
|
||||
{
|
||||
// Find record of previous allocation/reallocation
|
||||
record = _records.find(scl_memmgr_record(addr));
|
||||
if (record == _records.end()) {
|
||||
// todo: error reallocating memory not allocated?
|
||||
printf("scl_memmgr warning: Reallocation of not allocated memory at %s line %d\n", file, line);
|
||||
}
|
||||
else {
|
||||
// Update stats
|
||||
_allocated -= record->getsize();
|
||||
_deallocated_total += record->getsize();
|
||||
|
||||
// Erase previous allocation/reallocation
|
||||
_record_erase_busy = true;
|
||||
_records.erase(record);
|
||||
_record_erase_busy = false;
|
||||
}
|
||||
}
|
||||
#endif /* SCL_MEMMGR_ENABLE_CHECKS */
|
||||
|
||||
// Reallocate
|
||||
addr = realloc(addr, size);
|
||||
if (addr == NULL) {
|
||||
// todo: error reallocation failed
|
||||
printf("scl_memmgr error: Reallocation failed at %s line %d\n", file, line);
|
||||
}
|
||||
|
||||
#ifdef SCL_MEMMGR_ENABLE_CHECKS
|
||||
if (!_record_insert_busy)
|
||||
{
|
||||
// Store record for this reallocation
|
||||
_record_insert_busy = true;
|
||||
_records.insert(scl_memmgr_record(addr, size, file, line));
|
||||
_record_insert_busy = false;
|
||||
|
||||
// Update stats
|
||||
_allocated += size;
|
||||
if (_allocated > _maximum_allocated)
|
||||
_maximum_allocated = _allocated;
|
||||
_allocated_total += size;
|
||||
_reallocated_total += size;
|
||||
}
|
||||
#endif /* SCL_MEMMGR_ENABLE_CHECKS */
|
||||
|
||||
return addr;
|
||||
}
|
||||
|
||||
void scl_memmgr::deallocate( void * addr, const char *file, const int line ) {
|
||||
#ifdef SCL_MEMMGR_ENABLE_CHECKS
|
||||
scl_memmgr_record_iterator record;
|
||||
|
||||
if (!_record_erase_busy)
|
||||
{
|
||||
// Find record of previous allocation/reallocation
|
||||
record = _records.find(scl_memmgr_record(addr));
|
||||
if (record == _records.end()) {
|
||||
// todo: error free called for not allocated memory?
|
||||
printf("scl_memmgr warning: Deallocate of not allocated memory at %s line %d\n", file, line);
|
||||
}
|
||||
else {
|
||||
// Update stats
|
||||
_allocated -= record->getsize();
|
||||
_deallocated_total += record->getsize();
|
||||
|
||||
// Erase record
|
||||
_record_erase_busy = true;
|
||||
_records.erase(record);
|
||||
_record_erase_busy = false;
|
||||
}
|
||||
}
|
||||
#endif /* SCL_MEMMGR_ENABLE_CHECKS */
|
||||
|
||||
// Deallocate
|
||||
free(addr);
|
||||
}
|
||||
|
||||
#ifdef SCL_MEMMGR_ENABLE_CHECKS
|
||||
/**
|
||||
scl_memmgr_error implementation
|
||||
*/
|
||||
scl_memmgr_error::scl_memmgr_error( const std::string &file, const unsigned int line ) {
|
||||
_srcfile = file;
|
||||
_srcline = line;
|
||||
_occurences = 1;
|
||||
}
|
||||
|
||||
scl_memmgr_error::scl_memmgr_error( const scl_memmgr_error &rhs ) {
|
||||
_srcfile = rhs._srcfile;
|
||||
_srcline = rhs._srcline;
|
||||
_occurences = rhs._occurences;
|
||||
}
|
||||
|
||||
scl_memmgr_error::~scl_memmgr_error( void ) {
|
||||
}
|
||||
|
||||
bool scl_memmgr_error::operator<( const scl_memmgr_error &rhs ) const {
|
||||
if (_srcfile == rhs._srcfile)
|
||||
return _srcline < rhs._srcline;
|
||||
return _srcfile < rhs._srcfile;
|
||||
}
|
||||
|
||||
std::string scl_memmgr_error::getsrcfile( void ) const {
|
||||
return _srcfile;
|
||||
}
|
||||
|
||||
unsigned int scl_memmgr_error::getsrcline( void ) const {
|
||||
return _srcline;
|
||||
}
|
||||
|
||||
unsigned int scl_memmgr_error::getoccurences( void ) const {
|
||||
return _occurences;
|
||||
}
|
||||
|
||||
/**
|
||||
scl_memmgr_record implementation
|
||||
*/
|
||||
scl_memmgr_record::scl_memmgr_record( void * addr, size_t size, const char *file, const unsigned int line ) {
|
||||
_addr = addr;
|
||||
_size = size;
|
||||
_srcfile = file;
|
||||
_srcline = line;
|
||||
}
|
||||
|
||||
scl_memmgr_record::scl_memmgr_record( void * addr ) {
|
||||
_addr = addr;
|
||||
_size = 0;
|
||||
_srcfile = "";
|
||||
_srcline = -1;
|
||||
}
|
||||
|
||||
scl_memmgr_record::scl_memmgr_record( const scl_memmgr_record &rhs ) {
|
||||
_addr = rhs._addr;
|
||||
_size = rhs._size;
|
||||
_srcfile = rhs._srcfile;
|
||||
_srcline = rhs._srcline;
|
||||
}
|
||||
|
||||
scl_memmgr_record::~scl_memmgr_record( void ) {
|
||||
}
|
||||
|
||||
bool scl_memmgr_record::operator<( const scl_memmgr_record &rhs ) const {
|
||||
return _addr < rhs._addr;
|
||||
}
|
||||
|
||||
void * scl_memmgr_record::getaddr( void ) const {
|
||||
return _addr;
|
||||
}
|
||||
|
||||
size_t scl_memmgr_record::getsize( void ) const {
|
||||
return _size;
|
||||
}
|
||||
|
||||
std::string scl_memmgr_record::getsrcfile( void ) const {
|
||||
return _srcfile;
|
||||
}
|
||||
|
||||
unsigned int scl_memmgr_record::getsrcline( void ) const {
|
||||
return _srcline;
|
||||
}
|
||||
|
||||
#endif /* SCL_MEMMGR_ENABLE_CHECKS */
|
||||
@@ -0,0 +1,80 @@
|
||||
#ifndef SCL_MEMMGR_H
|
||||
#define SCL_MEMMGR_H
|
||||
|
||||
#include <scl_export.h>
|
||||
|
||||
/**
|
||||
Platform specific defines
|
||||
*/
|
||||
#if defined(__MSVC__) || defined(__BORLAND__)
|
||||
#define THROW_STD_BAD_ALLOC
|
||||
#define THROW_EMPTY
|
||||
#else
|
||||
#define THROW_STD_BAD_ALLOC throw (std::bad_alloc)
|
||||
#define THROW_EMPTY throw ()
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
#include <cstddef>
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
SCL_BASE_EXPORT void * scl_malloc_fn( unsigned int size, const char *file, const int line );
|
||||
SCL_BASE_EXPORT void * scl_calloc_fn( unsigned int count, unsigned int size, const char *file, const int line );
|
||||
SCL_BASE_EXPORT void * scl_realloc_fn( void * addr, unsigned int size, const char *file, const int line );
|
||||
SCL_BASE_EXPORT void scl_free_fn( void * addr );
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
SCL_BASE_EXPORT void * scl_operator_new( size_t size, const char * file, const int line );
|
||||
SCL_BASE_EXPORT void scl_operator_delete( void * addr, const char *file, const int line );
|
||||
SCL_BASE_EXPORT void scl_operator_delete( void * addr );
|
||||
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#ifndef SCL_MEMMGR_CC
|
||||
|
||||
#define scl_malloc(size) scl_malloc_fn(size, __FILE__, __LINE__)
|
||||
#define scl_calloc(count, size) scl_calloc_fn(count, size, __FILE__, __LINE__)
|
||||
#define scl_realloc(addr, size) scl_realloc_fn(addr, size, __FILE__, __LINE__)
|
||||
#define scl_free(addr) scl_free_fn(addr)
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
#include <new>
|
||||
|
||||
inline void * operator new( size_t size, const char *file, const int line ) THROW_STD_BAD_ALLOC {
|
||||
return scl_operator_new(size, file, line);
|
||||
}
|
||||
|
||||
inline void * operator new[]( size_t size, const char *file, const int line ) THROW_STD_BAD_ALLOC {
|
||||
return scl_operator_new(size, file, line);
|
||||
}
|
||||
|
||||
inline void operator delete( void *addr, const char *file, const int line ) THROW_STD_BAD_ALLOC {
|
||||
scl_operator_delete(addr, file, line);
|
||||
}
|
||||
|
||||
inline void operator delete[]( void *addr, const char *file, const int line ) THROW_STD_BAD_ALLOC {
|
||||
scl_operator_delete(addr, file, line);
|
||||
}
|
||||
|
||||
inline void operator delete( void * addr ) THROW_EMPTY {
|
||||
scl_operator_delete(addr);
|
||||
}
|
||||
|
||||
inline void operator delete[]( void * addr ) THROW_EMPTY {
|
||||
scl_operator_delete(addr);
|
||||
}
|
||||
|
||||
#define new new(__FILE__, __LINE__)
|
||||
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* SCL_MEMMGR_CC */
|
||||
|
||||
#endif /* SCL_MEMMGR_H */
|
||||
@@ -0,0 +1,16 @@
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "scl_trace_fprintf.h"
|
||||
|
||||
void trace_fprintf (char const *sourcefile, int line, FILE* file, const char *format, ...) {
|
||||
va_list args;
|
||||
if( (file != stdout) && (file != stderr ) ) {
|
||||
fprintf(file, "/* source: %s:%d */", sourcefile, line);
|
||||
}
|
||||
va_start (args, format);
|
||||
vfprintf(file, format, args);
|
||||
va_end (args);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
#ifndef SCL_TRACE_FPRINTF_H
|
||||
#define SCL_TRACE_FPRINTF_H
|
||||
|
||||
/** \file scl_trace_fprintf.h
|
||||
* Used to track the source file and line where generated code is printed from
|
||||
* When enabled, comments are printed into the generated files for every 'fprintf':
|
||||
* / * source: scl/src/fedex_plus/selects.c:1375 * /
|
||||
* To enable, configure with 'cmake .. -DSCL_TRACE_FPRINTF=ON'
|
||||
*
|
||||
* This header must be included *after* all other headers, otherwise the compiler will
|
||||
* report errors in system headers.
|
||||
* \sa trace_fprintf
|
||||
**/
|
||||
|
||||
#include "scl_export.h"
|
||||
|
||||
/** used to find where generated c++ originates from in fedex_plus
|
||||
* To enable, configure with 'cmake .. -DSCL_TRACE_FPRINTF=ON'
|
||||
*/
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
SCL_BASE_EXPORT void trace_fprintf (char const *sourcefile, int line, FILE* file, const char *format, ...);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef SCL_TRACE_FPRINTF
|
||||
# define fprintf(...) trace_fprintf(__FILE__, __LINE__, __VA_ARGS__)
|
||||
#endif /* SCL_TRACE_FPRINTF */
|
||||
|
||||
#endif /* SCL_TRACE_FPRINTF_H */
|
||||
@@ -30,17 +30,21 @@ SET(LIBSTEPDAI_PRIVATE_HDRS
|
||||
|
||||
IF(MSVC OR BORLAND)
|
||||
add_definitions( -DSCL_DAI_DLL_EXPORTS )
|
||||
add_definitions( -DSCL_BASE_DLL_IMPORTS )
|
||||
add_definitions( -DSCL_UTILS_DLL_IMPORTS )
|
||||
ENDIF()
|
||||
|
||||
include_directories(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}
|
||||
${SCL_SOURCE_DIR}/src/base
|
||||
${SCL_SOURCE_DIR}/src/clstepcore
|
||||
${SCL_SOURCE_DIR}/src/clutils
|
||||
)
|
||||
|
||||
SCL_ADDLIB(stepdai "${LIBSTEPDAI_SRCS}" "steputils")
|
||||
SCL_ADDLIB(stepdai "${LIBSTEPDAI_SRCS}" "steputils base")
|
||||
|
||||
if(APPLE)
|
||||
set_target_properties(stepdai PROPERTIES LINK_FLAGS "-flat_namespace -undefined suppress")
|
||||
if(SCL_BUILD_SHARED_LIBS)
|
||||
set_target_properties(stepdai PROPERTIES LINK_FLAGS "-flat_namespace -undefined suppress")
|
||||
endif(SCL_BUILD_SHARED_LIBS)
|
||||
endif(APPLE)
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
|
||||
#include <memory.h>
|
||||
#include <math.h>
|
||||
#include "scl_memmgr.h"
|
||||
|
||||
// to help ObjectCenter
|
||||
#ifndef HAVE_MEMMOVE
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
|
||||
#include <sstream>
|
||||
#include <sdai.h>
|
||||
#include "scl_memmgr.h"
|
||||
|
||||
SDAI_Binary::SDAI_Binary( const char * str, int max ) {
|
||||
content = std::string( str, max );
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#include <math.h>
|
||||
|
||||
#include <sdai.h>
|
||||
#include "scl_memmgr.h"
|
||||
|
||||
// to help ObjectCenter
|
||||
#ifndef HAVE_MEMMOVE
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
//#include <EntityExtent.h>
|
||||
|
||||
#include <sdai.h>
|
||||
#include "scl_memmgr.h"
|
||||
|
||||
SDAI_Entity_extent::SDAI_Entity_extent( )
|
||||
: _definition( 0 ), _definition_name( 0 ), _owned_by( 0 ) {
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
#include <math.h>
|
||||
|
||||
#include <sdai.h>
|
||||
#include "scl_memmgr.h"
|
||||
|
||||
/*
|
||||
#include <EntityExtent.h>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
|
||||
#include <sdai.h>
|
||||
#include "scl_memmgr.h"
|
||||
|
||||
/*
|
||||
* NIST STEP Core Class Library
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
|
||||
#include <sdai.h>
|
||||
#include "scl_memmgr.h"
|
||||
|
||||
///////// SDAI_Model_contents_instances
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
* UArray implementation.
|
||||
*/
|
||||
#include <sdai.h>
|
||||
#include "scl_memmgr.h"
|
||||
|
||||
// to help ObjectCenter
|
||||
#ifndef HAVE_MEMMOVE
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#include <sdai.h>
|
||||
#include "scl_memmgr.h"
|
||||
|
||||
SDAI_sdaiObject::SDAI_sdaiObject() {
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#include <sdai.h>
|
||||
#include "scl_memmgr.h"
|
||||
|
||||
SDAI_Session_instance::SDAI_Session_instance() {
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
|
||||
#include <sdai.h>
|
||||
#include <sstream>
|
||||
#include "scl_memmgr.h"
|
||||
|
||||
SDAI_String::SDAI_String( const char * str, int max ) {
|
||||
content = std::string( str, max );
|
||||
|
||||
@@ -35,6 +35,7 @@ SET(LIBSTEPEDITOR_PRIVATE_HDRS
|
||||
|
||||
include_directories(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}
|
||||
${SCL_SOURCE_DIR}/src/base
|
||||
${SCL_SOURCE_DIR}/src/cldai
|
||||
${SCL_SOURCE_DIR}/src/clstepcore
|
||||
${SCL_SOURCE_DIR}/src/clutils
|
||||
@@ -42,13 +43,16 @@ include_directories(
|
||||
|
||||
if(MSVC OR BORLAND)
|
||||
add_definitions( -DSCL_EDITOR_DLL_EXPORTS )
|
||||
add_definitions( -DSCL_BASE_DLL_IMPORTS )
|
||||
add_definitions( -DSCL_CORE_DLL_IMPORTS )
|
||||
add_definitions( -DSCL_DAI_DLL_IMPORTS )
|
||||
add_definitions( -DSCL_UTILS_DLL_IMPORTS )
|
||||
endif()
|
||||
|
||||
SCL_ADDLIB(stepeditor "${LIBSTEPEDITOR_SRCS}" stepcore stepdai steputils)
|
||||
SCL_ADDLIB(stepeditor "${LIBSTEPEDITOR_SRCS}" "stepcore stepdai steputils base")
|
||||
|
||||
if(APPLE)
|
||||
set_target_properties(stepeditor PROPERTIES LINK_FLAGS "-flat_namespace -undefined suppress")
|
||||
if(SCL_BUILD_SHARED_LIBS)
|
||||
set_target_properties(stepeditor PROPERTIES LINK_FLAGS "-flat_namespace -undefined suppress")
|
||||
endif(SCL_BUILD_SHARED_LIBS)
|
||||
endif(APPLE)
|
||||
|
||||
+159
-739
File diff suppressed because it is too large
Load Diff
+25
-19
@@ -49,29 +49,35 @@ class SCL_EDITOR_EXPORT STEPfile {
|
||||
Registry & reg() {
|
||||
return _reg;
|
||||
}
|
||||
int _fileIdIncr; //Increment value to be added to FileId Numbers on input
|
||||
int _fileIdIncr; ///< Increment value to be added to FileId Numbers on input
|
||||
|
||||
//header information
|
||||
InstMgr * _headerInstances;
|
||||
Registry * _headerRegistry;
|
||||
|
||||
int _headerId; //STEPfile_id given to SDAI_Application_instance from header section
|
||||
int _headerId; ///< STEPfile_id given to SDAI_Application_instance from header section
|
||||
|
||||
//file information
|
||||
DirObj * _currentDir;
|
||||
std::string _fileName;
|
||||
|
||||
//the following are used to compute read/write progress
|
||||
std::ifstream::pos_type _iFileSize; ///< input file size
|
||||
std::ifstream::pos_type _iFileCurrentPosition; ///< input file position (from ifstream::tellg())
|
||||
bool _iFileStage1Done; ///< set immediately before ReadData1() returns
|
||||
int _oFileInstsWritten; ///< number of instances that have been written
|
||||
|
||||
//error information
|
||||
ErrorDescriptor _error;
|
||||
|
||||
// new errors
|
||||
int _entsNotCreated; // num entities not created in first pass
|
||||
int _entsInvalid; // num entities that had invalid attr values
|
||||
int _entsIncomplete; // num entities that had missing attr values
|
||||
// (includes entities that had invalid values
|
||||
// for required attrs)
|
||||
int _entsWarning; // num entities that may have had problems
|
||||
// with attrs - reported as an attr user msg
|
||||
int _entsNotCreated; ///< num entities not created in first pass
|
||||
int _entsInvalid; ///< num entities that had invalid attr values
|
||||
int _entsIncomplete; /**< num entities that had missing attr values
|
||||
(includes entities that had invalid values
|
||||
for required attrs)*/
|
||||
int _entsWarning; /**< num entities that may have had problems
|
||||
with attrs - reported as an attr user msg */
|
||||
|
||||
// old errors
|
||||
int _errorCount;
|
||||
@@ -111,6 +117,8 @@ class SCL_EDITOR_EXPORT STEPfile {
|
||||
}
|
||||
const std::string SetFileName( const std::string name = "" );
|
||||
const std::string TruncFileName( const std::string name ) const;
|
||||
float GetReadProgress() const;
|
||||
float GetWriteProgress() const;
|
||||
|
||||
//error information
|
||||
ErrorDescriptor & Error() { /* const */
|
||||
@@ -165,8 +173,8 @@ class SCL_EDITOR_EXPORT STEPfile {
|
||||
|
||||
protected:
|
||||
//member functions
|
||||
const std::string schemaName(); // returns and copies out schema name from header instances
|
||||
//called by ReadExchangeFile
|
||||
const 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 );
|
||||
|
||||
@@ -178,9 +186,8 @@ class SCL_EDITOR_EXPORT STEPfile {
|
||||
int HeaderId( int increment = 1 );
|
||||
int HeaderId( const std::string name );
|
||||
|
||||
int ReadData1( istream & in ); // first pass to create instances
|
||||
// second pass to read instances
|
||||
int ReadData2( istream & in, bool useTechCor = true );
|
||||
int ReadData1( istream & in ); /**< First pass, to create instances */
|
||||
int ReadData2( istream & in, bool useTechCor = true ); /**< Second pass, to read instances */
|
||||
|
||||
// obsolete
|
||||
int ReadWorkingData1( istream & in );
|
||||
@@ -188,18 +195,17 @@ class SCL_EDITOR_EXPORT STEPfile {
|
||||
|
||||
void ReadRestOfFile( istream & in );
|
||||
|
||||
// create instance - used by ReadData1()
|
||||
/// create instance - used by ReadData1()
|
||||
SDAI_Application_instance * CreateInstance( istream & in, ostream & out );
|
||||
// create complex instance - used by CreateInstance()
|
||||
/// create complex instance - used by CreateInstance()
|
||||
SDAI_Application_instance * CreateSubSuperInstance( istream & in, int fileid,
|
||||
ErrorDescriptor & );
|
||||
|
||||
// read the instance - used by ReadData2()
|
||||
/// 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
|
||||
// these functions are stubs
|
||||
/// reading scopes are still incomplete, CreateScopeInstances and ReadScopeInstances are stubs
|
||||
Severity CreateScopeInstances( istream & in, SDAI_Application_instance_ptr ** scopelist );
|
||||
Severity ReadScopeInstances( istream & in );
|
||||
// Severity ReadSubSuperInstance(istream& in);
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
#include <cmath>
|
||||
|
||||
#include <cstring>
|
||||
#include "scl_memmgr.h"
|
||||
|
||||
extern void HeaderSchemaInit( Registry & reg );
|
||||
|
||||
@@ -28,7 +29,9 @@ STEPfile::STEPfile( Registry & r, InstMgr & i, const std::string filename, bool
|
||||
_instances( i ), _reg( r ), _fileIdIncr( 0 ), _headerId( 0 ),
|
||||
_entsNotCreated( 0 ), _entsInvalid( 0 ), _entsIncomplete( 0 ),
|
||||
_entsWarning( 0 ), _errorCount( 0 ), _warningCount( 0 ),
|
||||
_maxErrorCount( 5000 ), _strict( strict ) {
|
||||
_maxErrorCount( 5000 ), _strict( strict ),_iFileSize( 0 ),
|
||||
_iFileCurrentPosition( 0 ), _oFileInstsWritten( 0 ),
|
||||
_iFileStage1Done( false ) {
|
||||
SetFileType( VERSION_CURRENT );
|
||||
SetFileIdIncrement();
|
||||
_currentDir = new DirObj( "" );
|
||||
@@ -42,8 +45,6 @@ STEPfile::STEPfile( Registry & r, InstMgr & i, const std::string filename, bool
|
||||
STEPfile::~STEPfile() {
|
||||
delete _currentDir;
|
||||
|
||||
// remove everything from the Registry before deleting it
|
||||
_headerRegistry->DeleteContents();
|
||||
delete _headerRegistry;
|
||||
|
||||
_headerInstances->DeleteInstances();
|
||||
@@ -173,6 +174,8 @@ Severity STEPfile::AppendWorkingFile( const std::string filename, bool useTechCo
|
||||
|
||||
/******************************************************/
|
||||
istream * STEPfile::OpenInputFile( const std::string filename ) {
|
||||
_iFileCurrentPosition = 0;
|
||||
|
||||
// if there's no filename to use, fail
|
||||
if( filename.empty() && FileName().empty() ) {
|
||||
_error.AppendToUserMsg( "Unable to open file for input. No current file name.\n" );
|
||||
@@ -204,6 +207,10 @@ istream * STEPfile::OpenInputFile( const std::string filename ) {
|
||||
return ( 0 );
|
||||
}
|
||||
|
||||
//check size of file
|
||||
in->seekg( 0, std::ifstream::end );
|
||||
_iFileSize = in->tellg();
|
||||
in->seekg( 0, std::ifstream::beg );
|
||||
return in;
|
||||
}
|
||||
|
||||
@@ -212,6 +219,10 @@ void STEPfile::CloseInputFile( istream * in ) {
|
||||
if( in && *in != std::cin ) {
|
||||
delete in;
|
||||
}
|
||||
|
||||
//reset file size
|
||||
_iFileSize = 0;
|
||||
_iFileCurrentPosition = 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -239,10 +250,12 @@ ofstream * STEPfile::OpenOutputFile( const std::string filename ) {
|
||||
_error.AppendToUserMsg( "unable to open file for output\n" );
|
||||
_error.GreaterSeverity( SEVERITY_INPUT_ERROR );
|
||||
}
|
||||
_oFileInstsWritten = 0;
|
||||
return out;
|
||||
}
|
||||
|
||||
void STEPfile::CloseOutputFile( ostream * out ) {
|
||||
_oFileInstsWritten = 0;
|
||||
delete out;
|
||||
}
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@ extern ofstream * logStream;
|
||||
#include <ExpDict.h>
|
||||
#include <STEPattribute.h>
|
||||
#include <SdaiHeaderSchema.h>
|
||||
#include "scl_memmgr.h"
|
||||
|
||||
Schema * s_header_section_schema = 0;
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
// regenerate it.
|
||||
|
||||
#include <SdaiHeaderSchema.h>
|
||||
#include "scl_memmgr.h"
|
||||
|
||||
void HeaderInitSchemasAndEnts( Registry & reg ) {
|
||||
Uniqueness_rule_ptr ur;
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#include <ExpDict.h>
|
||||
#include <STEPattribute.h>
|
||||
#include <SdaiHeaderSchema.h>
|
||||
#include "scl_memmgr.h"
|
||||
|
||||
void SdaiHEADER_SECTION_SCHEMAInit( Registry & reg ) {
|
||||
header_section_schemat_time_stamp_text->ReferentType( t_sdaiSTRING );
|
||||
@@ -52,12 +53,13 @@ void SdaiHEADER_SECTION_SCHEMAInit( Registry & reg ) {
|
||||
header_section_schemae_file_population->AddExplicitAttr( a_3determination_method );
|
||||
SetTypeDescriptor * t_0 = new SetTypeDescriptor;
|
||||
t_0->AssignAggrCreator( ( AggregateCreator ) create_StringAggregate ); // Creator function
|
||||
t_0->Bound1( 1 );
|
||||
t_0->Bound2( 2147483647 );
|
||||
t_0->SetBound1( 1 );
|
||||
t_0->SetBound2( 2147483647 );
|
||||
t_0->FundamentalType( SET_TYPE );
|
||||
t_0->Description( "SET [1:?] OF section_name" );
|
||||
t_0->OriginatingSchema( s_header_section_schema );
|
||||
t_0->ReferentType( header_section_schemat_section_name );
|
||||
s_header_section_schema->AddUnnamedType(t_0);
|
||||
a_4governed_sections =
|
||||
new AttrDescriptor( "governed_sections", t_0, LTrue, LFalse, AttrType_Explicit,
|
||||
*header_section_schemae_file_population );
|
||||
@@ -79,24 +81,26 @@ void SdaiHEADER_SECTION_SCHEMAInit( Registry & reg ) {
|
||||
header_section_schemae_file_name->AddExplicitAttr( a_6time_stamp );
|
||||
ListTypeDescriptor * t_1 = new ListTypeDescriptor;
|
||||
t_1->AssignAggrCreator( ( AggregateCreator ) create_StringAggregate ); // Creator function
|
||||
t_1->Bound1( 1 );
|
||||
t_1->Bound2( 2147483647 );
|
||||
t_1->SetBound1( 1 );
|
||||
t_1->SetBound2( 2147483647 );
|
||||
t_1->FundamentalType( LIST_TYPE );
|
||||
t_1->Description( "LIST [1:?] OF STRING (256)" );
|
||||
t_1->OriginatingSchema( s_header_section_schema );
|
||||
t_1->ReferentType( t_sdaiSTRING );
|
||||
s_header_section_schema->AddUnnamedType(t_1);
|
||||
a_7author =
|
||||
new AttrDescriptor( "author", t_1, LFalse, LFalse, AttrType_Explicit,
|
||||
*header_section_schemae_file_name );
|
||||
header_section_schemae_file_name->AddExplicitAttr( a_7author );
|
||||
ListTypeDescriptor * t_2 = new ListTypeDescriptor;
|
||||
t_2->AssignAggrCreator( ( AggregateCreator ) create_StringAggregate ); // Creator function
|
||||
t_2->Bound1( 1 );
|
||||
t_2->Bound2( 2147483647 );
|
||||
t_2->SetBound1( 1 );
|
||||
t_2->SetBound2( 2147483647 );
|
||||
t_2->FundamentalType( LIST_TYPE );
|
||||
t_2->Description( "LIST [1:?] OF STRING (256)" );
|
||||
t_2->OriginatingSchema( s_header_section_schema );
|
||||
t_2->ReferentType( t_sdaiSTRING );
|
||||
s_header_section_schema->AddUnnamedType(t_2);
|
||||
a_8organization =
|
||||
new AttrDescriptor( "organization", t_2, LFalse, LFalse, AttrType_Explicit,
|
||||
*header_section_schemae_file_name );
|
||||
@@ -128,12 +132,13 @@ void SdaiHEADER_SECTION_SCHEMAInit( Registry & reg ) {
|
||||
header_section_schemae_section_context->AddExplicitAttr( a_12section );
|
||||
ListTypeDescriptor * t_3 = new ListTypeDescriptor;
|
||||
t_3->AssignAggrCreator( ( AggregateCreator ) create_StringAggregate ); // Creator function
|
||||
t_3->Bound1( 1 );
|
||||
t_3->Bound2( 2147483647 );
|
||||
t_3->SetBound1( 1 );
|
||||
t_3->SetBound2( 2147483647 );
|
||||
t_3->FundamentalType( LIST_TYPE );
|
||||
t_3->Description( "LIST [1:?] OF context_name" );
|
||||
t_3->OriginatingSchema( s_header_section_schema );
|
||||
t_3->ReferentType( header_section_schemat_context_name );
|
||||
s_header_section_schema->AddUnnamedType(t_3);
|
||||
a_13context_identifiers =
|
||||
new AttrDescriptor( "context_identifiers", t_3, LFalse, LFalse, AttrType_Explicit,
|
||||
*header_section_schemae_section_context );
|
||||
@@ -145,12 +150,13 @@ void SdaiHEADER_SECTION_SCHEMAInit( Registry & reg ) {
|
||||
|
||||
ListTypeDescriptor * t_4 = new ListTypeDescriptor;
|
||||
t_4->AssignAggrCreator( ( AggregateCreator ) create_StringAggregate ); // Creator function
|
||||
t_4->Bound1( 1 );
|
||||
t_4->Bound2( 2147483647 );
|
||||
t_4->SetBound1( 1 );
|
||||
t_4->SetBound2( 2147483647 );
|
||||
t_4->FundamentalType( LIST_TYPE );
|
||||
t_4->Description( "LIST [1:?] OF STRING (256)" );
|
||||
t_4->OriginatingSchema( s_header_section_schema );
|
||||
t_4->ReferentType( t_sdaiSTRING );
|
||||
s_header_section_schema->AddUnnamedType(t_4);
|
||||
a_14description =
|
||||
new AttrDescriptor( "description", t_4, LFalse, LFalse, AttrType_Explicit,
|
||||
*header_section_schemae_file_description );
|
||||
@@ -167,13 +173,14 @@ void SdaiHEADER_SECTION_SCHEMAInit( Registry & reg ) {
|
||||
|
||||
ListTypeDescriptor * t_5 = new ListTypeDescriptor;
|
||||
t_5->AssignAggrCreator( ( AggregateCreator ) create_StringAggregate ); // Creator function
|
||||
t_5->Bound1( 1 );
|
||||
t_5->Bound2( 2147483647 );
|
||||
t_5->SetBound1( 1 );
|
||||
t_5->SetBound2( 2147483647 );
|
||||
t_5->UniqueElements( LTrue );
|
||||
t_5->FundamentalType( LIST_TYPE );
|
||||
t_5->Description( "LIST [1:?] OF UNIQUE schema_name" );
|
||||
t_5->OriginatingSchema( s_header_section_schema );
|
||||
t_5->ReferentType( header_section_schemat_schema_name );
|
||||
s_header_section_schema->AddUnnamedType(t_5);
|
||||
a_16schema_identifiers =
|
||||
new AttrDescriptor( "schema_identifiers", t_5, LFalse, LFalse, AttrType_Explicit,
|
||||
*header_section_schemae_file_schema );
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
// regenerate it.
|
||||
|
||||
#include <SdaiSchemaInit.h>
|
||||
#include "scl_memmgr.h"
|
||||
|
||||
void HeaderSchemaInit( Registry & reg ) {
|
||||
HeaderInitSchemasAndEnts( reg );
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
*/
|
||||
|
||||
#include <cmdmgr.h>
|
||||
|
||||
#include "scl_memmgr.h"
|
||||
|
||||
ReplicateLinkNode * ReplicateList::FindNode( MgrNode * mn ) {
|
||||
ReplicateLinkNode * rln = ( ReplicateLinkNode * )GetHead();
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
#include <dispnode.h>
|
||||
#include <dispnodelist.h>
|
||||
#include "scl_memmgr.h"
|
||||
|
||||
// define this to be the name of the display object
|
||||
class StepEntityEditor;
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
#include <mgrnodelist.h>
|
||||
#include <dispnode.h>
|
||||
#include <dispnodelist.h>
|
||||
|
||||
#include "scl_memmgr.h"
|
||||
|
||||
void DisplayNodeList::Remove( GenericNode * node ) {
|
||||
GenNodeList::Remove( node );
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
#include <sdai.h>
|
||||
#include <instmgr.h>
|
||||
#include "scl_memmgr.h"
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// debug_level >= 2 => tells when a command is chosen
|
||||
|
||||
@@ -53,11 +53,11 @@ class SCL_EDITOR_EXPORT InstMgr {
|
||||
virtual ~InstMgr();
|
||||
|
||||
// MASTER LIST OPERATIONS
|
||||
int InstanceCount() {
|
||||
int InstanceCount() const {
|
||||
return master->Count();
|
||||
}
|
||||
|
||||
int OwnsInstances() {
|
||||
int OwnsInstances() const {
|
||||
return _ownsInstances;
|
||||
}
|
||||
void OwnsInstances( int ownsInstances ) {
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
#include <sdai.h>
|
||||
|
||||
#include <iostream>
|
||||
#include "scl_memmgr.h"
|
||||
|
||||
void * MgrNode::SEE() {
|
||||
return ( di ? di->SEE() : 0 );
|
||||
|
||||
@@ -37,7 +37,7 @@ static int PrintFunctionTrace = 2;
|
||||
#include <sdai.h>
|
||||
|
||||
#include <string.h> // to get bcopy() - ANSI
|
||||
|
||||
#include "scl_memmgr.h"
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// class MgrNodeArray member functions
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
#include <mgrnodelist.h>
|
||||
#include <dispnode.h>
|
||||
#include <dispnodelist.h>
|
||||
|
||||
#include "scl_memmgr.h"
|
||||
|
||||
MgrNodeList::MgrNodeList( stateEnum type ) : GenNodeList( new MgrNode() ) {
|
||||
// if(debug_level >= PrintFunctionTrace)
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#include <needFunc.h>
|
||||
#include "scl_memmgr.h"
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Function defined as a stub (necessary to use the scl)
|
||||
|
||||
@@ -49,6 +49,7 @@ endif()
|
||||
|
||||
if(MSVC OR BORLAND)
|
||||
add_definitions( -DSCL_CORE_DLL_EXPORTS )
|
||||
add_definitions( -DSCL_BASE_DLL_IMPORTS )
|
||||
add_definitions( -DSCL_EXPRESS_DLL_IMPORTS )
|
||||
add_definitions( -DSCL_UTILS_DLL_IMPORTS )
|
||||
add_definitions( -DSCL_DAI_DLL_IMPORTS )
|
||||
@@ -78,12 +79,15 @@ SET(LIBSTEPCORE_PRIVATE_HDRS
|
||||
|
||||
include_directories(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}
|
||||
${SCL_SOURCE_DIR}/src/base
|
||||
${SCL_SOURCE_DIR}/src/cldai
|
||||
${SCL_SOURCE_DIR}/src/cleditor
|
||||
${SCL_SOURCE_DIR}/src/clutils
|
||||
)
|
||||
|
||||
SCL_ADDLIB(stepcore "${LIBSTEPCORE_SRCS} ${LIBDEPEND_SRCS}" "express steputils stepdai")
|
||||
SCL_ADDLIB(stepcore "${LIBSTEPCORE_SRCS} ${LIBDEPEND_SRCS}" "express steputils stepdai base")
|
||||
if(APPLE)
|
||||
set_target_properties(stepcore PROPERTIES LINK_FLAGS "-flat_namespace -undefined suppress")
|
||||
if(SCL_BUILD_SHARED_LIBS)
|
||||
set_target_properties(stepcore PROPERTIES LINK_FLAGS "-flat_namespace -undefined suppress")
|
||||
endif(SCL_BUILD_SHARED_LIBS)
|
||||
endif(APPLE)
|
||||
|
||||
+26
-17
@@ -18,6 +18,7 @@
|
||||
|
||||
#include <ExpDict.h>
|
||||
#include <STEPaggregate.h>
|
||||
#include "scl_memmgr.h"
|
||||
|
||||
|
||||
Explicit_item_id__set::Explicit_item_id__set( int defaultSize ) {
|
||||
@@ -321,11 +322,8 @@ Interface_spec::~Interface_spec() {
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void Schema::AddFunction( const char * f ) {
|
||||
if( _function_list == 0 ) {
|
||||
_function_list = new scl_char_str__list;
|
||||
}
|
||||
_function_list->Append( ( char * )f );
|
||||
void Schema::AddFunction( const std::string & f ) {
|
||||
_function_list.push_back( f );
|
||||
}
|
||||
|
||||
void Schema::AddGlobal_rule( Global_rule_ptr gr ) {
|
||||
@@ -339,11 +337,8 @@ void Schema::AddGlobal_rule( Global_rule_ptr gr ) {
|
||||
void Schema::global_rules_( Global_rule__set_var & grs ) {
|
||||
}
|
||||
|
||||
void Schema::AddProcedure( const char * p ) {
|
||||
if( _procedure_list == 0 ) {
|
||||
_procedure_list = new scl_char_str__list;
|
||||
}
|
||||
_procedure_list->Append( ( char * )p );
|
||||
void Schema::AddProcedure( const std::string & p ) {
|
||||
_procedure_list.push_back( p );
|
||||
}
|
||||
|
||||
/// the whole schema
|
||||
@@ -368,18 +363,18 @@ void Schema::GenerateExpress( ostream & out ) const {
|
||||
out << endl << ( *_global_rules )[i]->rule_text_() << endl;
|
||||
}
|
||||
}
|
||||
if( _function_list != 0 ) {
|
||||
if( !_function_list.empty() ) {
|
||||
out << "(* *************FUNCTIONS************* *)" << endl;
|
||||
count = _function_list->Count();
|
||||
count = _function_list.size();
|
||||
for( i = 0; i < count; i++ ) {
|
||||
out << endl << ( *_function_list )[i] << endl;
|
||||
out << endl << _function_list[i] << endl;
|
||||
}
|
||||
}
|
||||
if( _procedure_list != 0 ) {
|
||||
if( !_procedure_list.empty() ) {
|
||||
out << "(* *************PROCEDURES************* *)" << endl;
|
||||
count = _procedure_list->Count();
|
||||
count = _procedure_list.size();
|
||||
for( i = 0; i < count; i++ ) {
|
||||
out << endl << ( *_procedure_list )[i] << endl;
|
||||
out << endl << _procedure_list[i] << endl;
|
||||
}
|
||||
}
|
||||
out << endl << "END_SCHEMA;" << endl;
|
||||
@@ -1030,6 +1025,8 @@ Where_rule__list::Where_rule__list( int defaultSize ) {
|
||||
}
|
||||
|
||||
Where_rule__list::~Where_rule__list() {
|
||||
Clear();
|
||||
|
||||
delete _buf;
|
||||
}
|
||||
|
||||
@@ -1107,6 +1104,9 @@ int Where_rule__list::Count() {
|
||||
}
|
||||
|
||||
void Where_rule__list::Clear() {
|
||||
for ( int i = 0; i < _count ; i ++ ) {
|
||||
delete _buf[i];
|
||||
}
|
||||
_count = 0;
|
||||
}
|
||||
|
||||
@@ -1135,6 +1135,8 @@ Uniqueness_rule__set::Uniqueness_rule__set( int defaultSize ) {
|
||||
}
|
||||
|
||||
Uniqueness_rule__set::~Uniqueness_rule__set() {
|
||||
Clear();
|
||||
|
||||
delete _buf;
|
||||
}
|
||||
|
||||
@@ -1212,6 +1214,9 @@ int Uniqueness_rule__set::Count() {
|
||||
}
|
||||
|
||||
void Uniqueness_rule__set::Clear() {
|
||||
for ( int i = 0; i < _count; i ++ ) {
|
||||
delete _buf[i];
|
||||
}
|
||||
_count = 0;
|
||||
}
|
||||
|
||||
@@ -1221,7 +1226,7 @@ Global_rule::Global_rule()
|
||||
: _entities( 0 ), _where_rules( 0 ), _parent_schema( 0 ) {
|
||||
}
|
||||
|
||||
Global_rule::Global_rule( const char * n, Schema_ptr parent_sch, const char * rt )
|
||||
Global_rule::Global_rule( const char * n, Schema_ptr parent_sch, const std::string & rt )
|
||||
: _name( n ), _entities( 0 ), _where_rules( 0 ), _parent_schema( parent_sch ),
|
||||
_rule_text( rt ) {
|
||||
}
|
||||
@@ -1252,6 +1257,7 @@ Global_rule__set::Global_rule__set( int defaultSize ) {
|
||||
}
|
||||
|
||||
Global_rule__set::~Global_rule__set() {
|
||||
Clear();
|
||||
delete _buf;
|
||||
}
|
||||
|
||||
@@ -1329,6 +1335,9 @@ int Global_rule__set::Count() {
|
||||
}
|
||||
|
||||
void Global_rule__set::Clear() {
|
||||
for ( int i = 0; i < _count; i ++ ) {
|
||||
delete _buf[i];
|
||||
}
|
||||
_count = 0;
|
||||
}
|
||||
|
||||
|
||||
+87
-19
@@ -15,6 +15,10 @@
|
||||
#include <scl_export.h>
|
||||
#include <sdai.h>
|
||||
|
||||
#include <deque>
|
||||
#include <string>
|
||||
#include <assert.h>
|
||||
|
||||
typedef SDAI_Application_instance * ( * Creator )() ;
|
||||
|
||||
enum AttrType_Enum {
|
||||
@@ -24,12 +28,18 @@ enum AttrType_Enum {
|
||||
AttrType_Redefining
|
||||
};
|
||||
|
||||
enum AggrBoundTypeEnum {
|
||||
bound_unset = 0,
|
||||
bound_constant,
|
||||
bound_runtime,
|
||||
bound_funcall
|
||||
};
|
||||
|
||||
#include <SingleLinkList.h>
|
||||
|
||||
#include <baseType.h>
|
||||
#include <dictdefs.h>
|
||||
#include <Str.h>
|
||||
#include <scl_char_str_list.h>
|
||||
|
||||
// defined and created in Registry.inline.cc
|
||||
extern SCL_CORE_EXPORT const TypeDescriptor * t_sdaiINTEGER;
|
||||
@@ -520,7 +530,7 @@ class SCL_CORE_EXPORT Global_rule : public Dictionary_instance {
|
||||
std::string _rule_text; // non-SDAI
|
||||
|
||||
Global_rule();
|
||||
Global_rule( const char * n, Schema_ptr parent_sch, const char * rt );
|
||||
Global_rule( const char * n, Schema_ptr parent_sch, const std::string & rt );
|
||||
Global_rule( Global_rule & ); // not fully implemented
|
||||
virtual ~Global_rule();
|
||||
|
||||
@@ -655,13 +665,14 @@ class SCL_CORE_EXPORT Schema : public Dictionary_instance {
|
||||
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)
|
||||
Interface_spec _interface; // list of USE and REF interfaces (SDAI)
|
||||
|
||||
// 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
|
||||
scl_char_str__list_var _function_list; // of EXPRESS functions
|
||||
scl_char_str__list_var _procedure_list; // of EXPRESS procedures
|
||||
std::deque< std::string > _function_list; // of EXPRESS functions
|
||||
std::deque< std::string > _procedure_list; // of EXPRESS procedures
|
||||
|
||||
Global_rule__set_var _global_rules;
|
||||
|
||||
@@ -695,11 +706,11 @@ class SCL_CORE_EXPORT Schema : public Dictionary_instance {
|
||||
return _ref_interface_list;
|
||||
}
|
||||
|
||||
scl_char_str__list_var function_list_() {
|
||||
std::deque< std::string > function_list_() {
|
||||
return _function_list;
|
||||
}
|
||||
|
||||
void AddFunction( const char * f );
|
||||
void AddFunction( const std::string & f );
|
||||
|
||||
Global_rule__set_var global_rules_() { // const
|
||||
return _global_rules;
|
||||
@@ -709,11 +720,11 @@ class SCL_CORE_EXPORT Schema : public Dictionary_instance {
|
||||
|
||||
void global_rules_( Global_rule__set_var & grs ); // not implemented
|
||||
|
||||
scl_char_str__list_var procedure_list_() {
|
||||
std::deque< std::string > procedure_list_() {
|
||||
return _procedure_list;
|
||||
}
|
||||
|
||||
void AddProcedure( const char * p );
|
||||
void AddProcedure( const std::string & p );
|
||||
|
||||
EntityDescLinkNode * AddEntity( EntityDescriptor * ed ) {
|
||||
return _entList.AddNode( ed );
|
||||
@@ -723,6 +734,10 @@ class SCL_CORE_EXPORT Schema : public Dictionary_instance {
|
||||
return _typeList.AddNode( td );
|
||||
}
|
||||
|
||||
TypeDescLinkNode * AddUnnamedType( TypeDescriptor * td ) {
|
||||
return _unnamed_typeList.AddNode( td );
|
||||
}
|
||||
|
||||
// the whole schema
|
||||
void GenerateExpress( ostream & out ) const;
|
||||
|
||||
@@ -1288,9 +1303,7 @@ class SCL_CORE_EXPORT TypeDescriptor {
|
||||
TypeDescriptor( const char * nm, PrimitiveType ft,
|
||||
Schema * origSchema, const char * d );
|
||||
TypeDescriptor( );
|
||||
virtual ~TypeDescriptor() {
|
||||
/* if ( altNames ) delete altNames; */
|
||||
}
|
||||
virtual ~TypeDescriptor();
|
||||
|
||||
virtual const char * GenerateExpress( std::string & buf ) const;
|
||||
|
||||
@@ -1544,7 +1557,7 @@ class SCL_CORE_EXPORT EntityDescriptor : public TypeDescriptor {
|
||||
void AddSubtype( EntityDescriptor * ed ) {
|
||||
_subtypes.AddNode( ed );
|
||||
}
|
||||
void AddSupertype_Stmt( const char * s ) {
|
||||
void AddSupertype_Stmt( const std::string & s ) {
|
||||
_supertype_stmt = s;
|
||||
}
|
||||
const char * Supertype_Stmt() {
|
||||
@@ -1631,6 +1644,8 @@ SCL_CORE_EXPORT RealAggregate * create_RealAggregate();
|
||||
|
||||
SCL_CORE_EXPORT IntAggregate * create_IntAggregate();
|
||||
|
||||
typedef SDAI_Integer (*boundCallbackFn)(SDAI_Application_instance *);
|
||||
|
||||
/**
|
||||
* \class AggrTypeDescriptor
|
||||
* I think we decided on a simplistic representation of aggr. types for now?
|
||||
@@ -1646,12 +1661,15 @@ class SCL_CORE_EXPORT AggrTypeDescriptor : public TypeDescriptor {
|
||||
|
||||
protected:
|
||||
|
||||
SDAI_Integer _bound1 ;
|
||||
SDAI_Integer _bound2 ;
|
||||
SDAI_Integer _bound1, _bound2;
|
||||
SDAI_LOGICAL _uniqueElements ;
|
||||
TypeDescriptor * _aggrDomainType ;
|
||||
AggregateCreator CreateNewAggr;
|
||||
|
||||
AggrBoundTypeEnum _bound1_type, _bound2_type;
|
||||
boundCallbackFn _bound1_callback, _bound2_callback;
|
||||
std::string _bound1_str, _bound2_str;
|
||||
|
||||
public:
|
||||
|
||||
void AssignAggrCreator( AggregateCreator f = 0 ) {
|
||||
@@ -1667,22 +1685,72 @@ 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 ), CreateNewAggr( f ) { }
|
||||
virtual ~AggrTypeDescriptor();
|
||||
|
||||
|
||||
SDAI_Integer & Bound1() {
|
||||
/// find bound type
|
||||
AggrBoundTypeEnum Bound1Type() const { return _bound1_type; };
|
||||
/// get a constant bound
|
||||
SDAI_Integer Bound1( ) const {
|
||||
assert( _bound1_type == bound_constant );
|
||||
return _bound1;
|
||||
}
|
||||
void Bound1( SDAI_Integer b1 ) {
|
||||
/// get a runtime bound using an object's 'this' pointer
|
||||
SDAI_Integer Bound1Runtime( SDAI_Application_instance* this_ptr) const {
|
||||
assert( this_ptr && ( _bound1_type == bound_runtime ) );
|
||||
return _bound1_callback(this_ptr) ;
|
||||
}
|
||||
/// get a bound's EXPRESS function call string
|
||||
std::string Bound1Funcall() const {
|
||||
return _bound1_str;
|
||||
}
|
||||
/// set bound to a constant
|
||||
void SetBound1( SDAI_Integer b1 ) {
|
||||
_bound1 = b1;
|
||||
_bound1_type = bound_constant;
|
||||
}
|
||||
///set bound's callback fn. only for bounds dependent on an attribute
|
||||
void SetBound1FromMemberAccessor( boundCallbackFn callback ) {
|
||||
_bound1_callback = callback;
|
||||
_bound1_type = bound_runtime;
|
||||
}
|
||||
///set bound from express function call. currently, this only stores the function call as a string.
|
||||
void SetBound1FromExpressFuncall( std::string s ) {
|
||||
_bound1_str = s;
|
||||
_bound1_type = bound_funcall;
|
||||
}
|
||||
|
||||
SDAI_Integer & Bound2() {
|
||||
/// find bound type
|
||||
AggrBoundTypeEnum Bound2Type() const { return _bound2_type; };
|
||||
/// get a constant bound
|
||||
SDAI_Integer Bound2( ) const {
|
||||
assert( _bound2_type == bound_constant );
|
||||
return _bound2;
|
||||
}
|
||||
void Bound2( SDAI_Integer b2 ) {
|
||||
/// get a runtime bound using an object's 'this' pointer
|
||||
SDAI_Integer Bound2Runtime( SDAI_Application_instance* this_ptr) const {
|
||||
assert( this_ptr && ( _bound2_type == bound_runtime ) );
|
||||
return _bound2_callback(this_ptr) ;
|
||||
}
|
||||
/// get a bound's EXPRESS function call string
|
||||
std::string Bound2Funcall() const {
|
||||
return _bound2_str;
|
||||
}
|
||||
/// set bound to a constant
|
||||
void SetBound2( SDAI_Integer b2 ) {
|
||||
_bound2 = b2;
|
||||
_bound2_type = bound_constant;
|
||||
}
|
||||
///set bound's callback fn
|
||||
void SetBound2FromMemberAccessor( boundCallbackFn callback ){
|
||||
_bound2_callback = callback;
|
||||
_bound2_type = bound_runtime;
|
||||
}
|
||||
///set bound from express function call. currently, this only stores the function call as a string.
|
||||
void SetBound2FromExpressFuncall( std::string s ) {
|
||||
_bound2_str = s;
|
||||
_bound2_type = bound_funcall;
|
||||
}
|
||||
|
||||
SDAI_LOGICAL & UniqueElements() {
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
*/
|
||||
|
||||
#include <ExpDict.h>
|
||||
#include "scl_memmgr.h"
|
||||
|
||||
Dictionary_instance::~Dictionary_instance() {
|
||||
}
|
||||
@@ -24,21 +25,22 @@ Schema::Schema( const char * schemaName )
|
||||
}
|
||||
|
||||
Schema::~Schema() {
|
||||
TypeDescLinkNode *node;
|
||||
|
||||
if( _use_interface_list != 0 ) {
|
||||
delete _use_interface_list;
|
||||
}
|
||||
if( _ref_interface_list != 0 ) {
|
||||
delete _ref_interface_list;
|
||||
}
|
||||
if( _function_list != 0 ) {
|
||||
delete _function_list;
|
||||
}
|
||||
if( _procedure_list != 0 ) {
|
||||
delete _procedure_list;
|
||||
}
|
||||
if( _global_rules != 0 ) {
|
||||
delete _global_rules;
|
||||
}
|
||||
node = (TypeDescLinkNode*) _unnamed_typeList.GetHead();
|
||||
while ( node ) {
|
||||
delete node->TypeDesc();
|
||||
node = (TypeDescLinkNode*) node->NextNode();
|
||||
}
|
||||
}
|
||||
|
||||
Interfaced_item::Interfaced_item() {
|
||||
@@ -121,6 +123,9 @@ AttrDescLinkNode::AttrDescLinkNode() {
|
||||
}
|
||||
|
||||
AttrDescLinkNode::~AttrDescLinkNode() {
|
||||
if ( _attrDesc ) {
|
||||
delete _attrDesc;
|
||||
}
|
||||
}
|
||||
|
||||
AttrDescItr::AttrDescItr( const AttrDescriptorList & adList ) : adl( adList ) {
|
||||
@@ -141,6 +146,13 @@ Inverse_attributeList::Inverse_attributeList() {
|
||||
}
|
||||
|
||||
Inverse_attributeList::~Inverse_attributeList() {
|
||||
Inverse_attributeLinkNode *node;
|
||||
|
||||
node = ( Inverse_attributeLinkNode* ) head;
|
||||
while ( node ) {
|
||||
delete node->Inverse_attr();
|
||||
node = ( Inverse_attributeLinkNode* ) node->NextNode();
|
||||
}
|
||||
}
|
||||
|
||||
Inverse_attributeLinkNode * Inverse_attributeList::AddNode( Inverse_attribute * ad ) {
|
||||
@@ -209,6 +221,12 @@ TypeDescriptor::TypeDescriptor
|
||||
_where_rules( 0 ) {
|
||||
}
|
||||
|
||||
TypeDescriptor::~TypeDescriptor() {
|
||||
if ( _where_rules ) {
|
||||
delete _where_rules;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines the current name of this. Normally, this is simply _name.
|
||||
* If "schnm" is set to a value, however, then this function becomes a
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user