Remove base library from stepcode

Move specific pieces of logic still in use next to the individual parts
of the code that use them, and eliminate base from the code.
This commit is contained in:
Clifford Yapp
2022-09-26 20:52:17 +01:00
committed by Chris HORLER
parent fdf271c888
commit 7dbda20be0
154 changed files with 829 additions and 1216 deletions
-2
View File
@@ -120,7 +120,6 @@ option(BUILD_STATIC_LIBS "Build static libraries" OFF)
option(SC_PYTHON_GENERATOR "Compile exp2python" ON)
option(SC_CPP_GENERATOR "Compile exp2cxx" ON)
option(SC_MEMMGR_ENABLE_CHECKS "Enable sc_memmgr's memory leak detection" OFF)
option(SC_TRACE_FPRINTF "Enable extra comments in generated code so the code's source in exp2cxx may be located" OFF)
option(SC_ENABLE_COVERAGE "Enable code coverage test" OFF)
@@ -189,7 +188,6 @@ include_directories(
${SC_BINARY_DIR}/include
)
add_subdirectory(src/base)
add_subdirectory(src/express)
add_subdirectory(src/exppp)
add_subdirectory(src/exp2cxx)
+7 -7
View File
@@ -27,16 +27,16 @@ endmacro(P21_TESTS sfile)
# create p21read_sdai_*, lazy_sdai_*, any exes listed in SC_SDAI_ADDITIONAL_EXES_SRCS
macro(SCHEMA_EXES)
RELATIVE_PATH_TO_TOPLEVEL(${CMAKE_CURRENT_SOURCE_DIR} RELATIVE_PATH_COMPONENT)
SC_ADDEXEC(p21read_${PROJECT_NAME} SOURCES "${RELATIVE_PATH_COMPONENT}/src/test/p21read/p21read.cc" LINK_LIBRARIES ${PROJECT_NAME} stepdai stepcore stepeditor steputils base TESTABLE)
SC_ADDEXEC(p21read_${PROJECT_NAME} SOURCES "${RELATIVE_PATH_COMPONENT}/src/test/p21read/p21read.cc;${RELATIVE_PATH_COMPONENT}/src/test/p21read/sc_benchmark.cc" LINK_LIBRARIES ${PROJECT_NAME} stepdai stepcore stepeditor steputils TESTABLE)
if(NOT WIN32)
SC_ADDEXEC(lazy_${PROJECT_NAME} SOURCES "${RELATIVE_PATH_COMPONENT}/src/cllazyfile/lazy_test.cc" LINK_LIBRARIES ${PROJECT_NAME} steplazyfile stepdai stepcore stepeditor steputils base TESTABLE)
SC_ADDEXEC(lazy_${PROJECT_NAME} SOURCES "${RELATIVE_PATH_COMPONENT}/src/cllazyfile/lazy_test.cc;${RELATIVE_PATH_COMPONENT}/src/cllazyfile/sc_benchmark.cc" LINK_LIBRARIES ${PROJECT_NAME} steplazyfile stepdai stepcore stepeditor steputils TESTABLE)
endif(NOT WIN32)
#add user-defined executables
foreach(src ${SC_SDAI_ADDITIONAL_EXES_SRCS})
get_filename_component(name ${src} NAME_WE)
get_filename_component(path ${src} ABSOLUTE)
SC_ADDEXEC(${name}_${PROJECT_NAME} SOURCES ${src} LINK_LIBRARIES ${PROJECT_NAME} stepdai stepcore stepeditor steputils base TESTABLE)
SC_ADDEXEC(${name}_${PROJECT_NAME} SOURCES ${src} LINK_LIBRARIES ${PROJECT_NAME} stepdai stepcore stepeditor steputils TESTABLE)
#set_target_properties(${name}_${PROJECT_NAME} PROPERTIES COMPILE_FLAGS "${${PROJECT_NAME}_COMPILE_FLAGS} -I${path}")
endforeach(src ${SC_SDAI_ADDITIONAL_EXES_SRCS})
ENDMACRO(SCHEMA_EXES)
@@ -89,12 +89,12 @@ macro(SCHEMA_TARGETS expFile schemaName sourceFiles)
)
include_directories(
${CMAKE_CURRENT_SOURCE_DIR} ${SC_SOURCE_DIR}/src/cldai ${SC_SOURCE_DIR}/src/cleditor
${SC_SOURCE_DIR}/src/clutils ${SC_SOURCE_DIR}/src/clstepcore ${SC_SOURCE_DIR}/src/base
${SC_SOURCE_DIR}/src/base/judy/src
${SC_SOURCE_DIR}/src/clutils ${SC_SOURCE_DIR}/src/clstepcore ${SC_SOURCE_DIR}/src/cllazyfile
${SC_SOURCE_DIR}/src/cllazyfile/judy/src
)
# if testing is enabled, "TESTABLE" sets property EXCLUDE_FROM_ALL and prevents installation
if(BUILD_SHARED_LIBS)
SC_ADDLIB(${PROJECT_NAME} SHARED SOURCES ${sourceFiles} LINK_LIBRARIES stepdai stepcore stepeditor steputils base TESTABLE)
SC_ADDLIB(${PROJECT_NAME} SHARED SOURCES ${sourceFiles} LINK_LIBRARIES stepdai stepcore stepeditor steputils TESTABLE)
add_dependencies(${PROJECT_NAME} generate_cpp_${PROJECT_NAME})
if(WIN32)
target_compile_definitions("${PROJECT_NAME}" PRIVATE SC_SCHEMA_DLL_EXPORTS)
@@ -111,7 +111,7 @@ macro(SCHEMA_TARGETS expFile schemaName sourceFiles)
endif()
if($CACHE{SC_BUILD_STATIC_LIBS})
SC_ADDLIB(${PROJECT_NAME}-static STATIC SOURCES ${sourceFiles} LINK_LIBRARIES stepdai-static stepcore-static stepeditor-static steputils-static base-static TESTABLE)
SC_ADDLIB(${PROJECT_NAME}-static STATIC SOURCES ${sourceFiles} LINK_LIBRARIES stepdai-static stepcore-static stepeditor-static steputils-static TESTABLE)
add_dependencies(${PROJECT_NAME}-static generate_cpp_${PROJECT_NAME})
target_compile_defines("${PROJECT_NAME}-static" PRIVATE SC_STATIC)
if(MSVC)
-2
View File
@@ -16,7 +16,6 @@ set(SC_BINARY_DIR ${SC_BUILDDIR})
include(${CMAKE_CURRENT_SOURCE_DIR}/../SC_Outdirs.cmake)
set(schema_scanner_src
${SC_ROOT}/src/base/sc_mkdir.c
${SC_ROOT}/src/exp2cxx/genCxxFilenames.c
${SC_ROOT}/src/exp2cxx/class_strings.c
${SC_ROOT}/src/express/generated/expparse.c
@@ -52,7 +51,6 @@ include_directories(
${SC_ROOT}/include/
${SC_ROOT}/src/express/
${SC_ROOT}/src/express/generated
${SC_ROOT}/src/base
${SC_ROOT}/src/exp2cxx
${SC_BUILDDIR}/include
)
+41 -12
View File
@@ -14,20 +14,25 @@
*/
extern "C" {
# include "expparse.h"
# include "expscan.h"
# include "express/scope.h"
# include "genCxxFilenames.h"
# include "sc_mkdir.h"
#define _XOPEN_SOURCE /* for S_IFDIR */
# include <string.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <errno.h>
# ifdef _WIN32
# include <direct.h>
# define getcwd _getcwd
# else
# include <unistd.h>
# endif
#include "expparse.h"
#include "expscan.h"
#include "express/scope.h"
#include "genCxxFilenames.h"
#include <string.h>
#ifdef _WIN32
# include <direct.h>
# define getcwd _getcwd
#else
# include <unistd.h>
#endif
}
#include <string>
@@ -125,6 +130,30 @@ string makeShortName( const char * longName ) {
return filename;
}
/* cross-platform mkdir */
int sc_mkdir( const char * path ) {
#ifdef _WIN32
return mkdir( path );
#else
return mkdir( path, 0777 );
#endif /* _WIN32 */
}
/* return -1 if error, 0 if created, 1 if dir existed already */
static int mkDirIfNone( const char * path ) {
struct stat s;
if( stat( path, &s ) != 0 ) {
if( errno == ENOENT ) {
return sc_mkdir( path );
}
} else if( s.st_mode & S_IFDIR ) {
return 1;
}
/* either stat returned an error other than ENOENT, or 'path' exists but isn't a dir */
return -1;
}
/** write a CMakeLists.txt file for the schema; print its directory to stdout for CMake's add_subdirectory() command */
void writeLists( const char * schemaName, stringstream & eh, stringstream & ei, int ecount,
stringstream & th, stringstream & ti, int tcount ) {
+1 -2
View File
@@ -51,14 +51,13 @@ endif(NOT EXISTS ${SCHEMA_FILE})
get_filename_component(SCHEMA_SN ${SCHEMA_FILE} NAME)
string(REGEX REPLACE "\(.*\).[Ee][Xx][Pp]" "sdai_\\1" SCHEMA_LINK_NAME ${SCHEMA_SN})
set(STEPCODE_LIBRARIES base stepcore stepeditor stepdai steputils ${SCHEMA_LINK_NAME})
set(STEPCODE_LIBRARIES stepcore stepeditor stepdai steputils ${SCHEMA_LINK_NAME})
# Add STEPCode project to CMake build.
add_subdirectory(${STEPCODE_ROOT_DIR} "${CMAKE_CURRENT_BINARY_DIR}/sc" EXCLUDE_FROM_ALL)
# Set up STEPcode include directories.
set(STEPCODE_INCLUDE_DIR
${STEPCODE_ROOT_DIR}/src/base
${STEPCODE_ROOT_DIR}/src/clstepcore
${STEPCODE_ROOT_DIR}/src/cldai
${STEPCODE_ROOT_DIR}/src/clutils
@@ -19,7 +19,6 @@ INCLUDE( External_STEPCode )
IF(NOT WIN32)
set( STEPCODE_LIBRARIES
${STEPCODE_INSTALL_DIR}/lib/libbase.a
${STEPCODE_INSTALL_DIR}/lib/libstepcore.a
${STEPCODE_INSTALL_DIR}/lib/libstepeditor.a
${STEPCODE_INSTALL_DIR}/lib/libstepdai.a
@@ -28,7 +27,6 @@ IF(NOT WIN32)
)
ELSE()
set( STEPCODE_LIBRARIES
${STEPCODE_INSTALL_DIR}/lib/libbase.lib
${STEPCODE_INSTALL_DIR}/lib/libstepcore.lib
${STEPCODE_INSTALL_DIR}/lib/libstepeditor.lib
${STEPCODE_INSTALL_DIR}/lib/libstepdai.lib
@@ -44,7 +42,6 @@ MESSAGE( STATUS "STEPCODE_INSTALL_DIR: " ${STEPCODE_INSTALL_DIR} )
set( STEPCODE_INCLUDE_DIR
${STEPCODE_INSTALL_DIR}/include/stepcode
${STEPCODE_INSTALL_DIR}/include/stepcode/base
${STEPCODE_INSTALL_DIR}/include/stepcode/clstepcore
${STEPCODE_INSTALL_DIR}/include/stepcode/cldai
${STEPCODE_INSTALL_DIR}/include/stepcode/clutils
-1
View File
@@ -15,7 +15,6 @@
#cmakedefine HAVE_IO_H 1
#cmakedefine SC_TRACE_FPRINTF 1
#cmakedefine SC_MEMMGR_ENABLE_CHECKS 1
#cmakedefine HAVE_ABS 1
#cmakedefine HAVE_MEMCPY 1
-1
View File
@@ -15,7 +15,6 @@
#cmakedefine HAVE_IO_H 1
#cmakedefine SC_TRACE_FPRINTF 1
#cmakedefine SC_MEMMGR_ENABLE_CHECKS 1
#cmakedefine HAVE_ABS 1
#cmakedefine HAVE_MEMCPY 1
+3
View File
@@ -96,5 +96,8 @@
typedef void ( *voidFuncptr )();
typedef int ( *intFuncptr )();
/* Option index - can we get rid of this? */
extern SC_EXPRESS_EXPORT int sc_optind;
#endif /* BASIC_H */
-72
View File
@@ -1,72 +0,0 @@
set(SC_BASE_SOURCES
sc_memmgr.cc
sc_trace_fprintf.c
sc_getopt.cc
sc_benchmark.cc
sc_mkdir.c
path2str.c
judy/src/judy.c
)
set(SC_BASE_HDRS
sc_benchmark.h
sc_memmgr.h
sc_getopt.h
sc_trace_fprintf.h
sc_mkdir.h
path2str.h
judy/src/judy.h
judy/src/judyLArray.h
judy/src/judyL2Array.h
judy/src/judySArray.h
judy/src/judyS2Array.h
)
include_directories(
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/judy/src
)
if($CACHE{SC_MEMMGR_ENABLE_CHECKS})
add_definitions(-DSC_MEMMGR_ENABLE_CHECKS)
endif()
if(BUILD_SHARED_LIBS)
SC_ADDLIB(base SHARED SOURCES ${SC_BASE_SOURCES})
if(WIN32)
target_link_libraries(base psapi)
target_compile_definitions(base PRIVATE SC_BASE_DLL_EXPORTS)
endif()
endif()
if(BUILD_STATIC_LIBS)
SC_ADDLIB(base-static STATIC SOURCES ${SC_BASE_SOURCES})
if(WIN32)
target_link_libraries(base-static psapi)
endif()
endif()
if(NOT IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/judy/src")
message("Judy array source code not found. Downloading (don't sweat, it's public domain)...")
file(DOWNLOAD "http://github.com/mpictor/judy-template/archive/master.tar.gz"
"${CMAKE_CURRENT_SOURCE_DIR}/judy.tar.gz" SHOW_PROGRESS)
execute_process(
COMMAND ${CMAKE_COMMAND} -E tar xzf "${CMAKE_CURRENT_SOURCE_DIR}/judy.tar.gz"
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/"
)
file(RENAME judy-template-master judy)
file(REMOVE "${CMAKE_CURRENT_SOURCE_DIR}/judy.tar.gz")
message("Judy array source code extracted.")
endif(NOT IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/judy/src")
install(FILES ${SC_BASE_HDRS}
DESTINATION ${INCLUDE_DIR}/stepcode/base)
# Local Variables:
# tab-width: 8
# mode: cmake
# indent-tabs-mode: t
# End:
# ex: shiftwidth=2 tabstop=8
-29
View File
@@ -1,29 +0,0 @@
#include "path2str.h"
#include "sc_memmgr.h"
#include <string.h>
/* for windows, rewrite backslashes in paths
* that will be written to generated code
*/
const char * path2str_fn( const char * fileMacro ) {
static char * result = 0;
static size_t rlen = 0;
char * p;
if( rlen < strlen( fileMacro ) ) {
if( result ) {
sc_free( result );
}
rlen = strlen( fileMacro );
result = ( char * )sc_malloc( rlen * sizeof( char ) + 1 );
}
strcpy( result, fileMacro );
p = result;
while( *p ) {
if( *p == '\\' ) {
*p = '/';
}
p++;
}
return result;
}
-20
View File
@@ -1,20 +0,0 @@
#ifndef PATH2STR_H
#define PATH2STR_H
#include <sc_export.h>
/** windows only: rewrite backslashes in paths as forward slashes
* call as path2str(__FILE__) to take advantage of macro
*
* silence "unknown escape sequence" warning when contents of __FILE__
* are fprintf'd into string in generated code
*/
SC_BASE_EXPORT const char * path2str_fn( const char * fileMacro );
#ifdef _WIN32
# define path2str(path) path2str_fn(path)
#else
# define path2str(path) path
#endif
#endif /* PATH2STR_H */
-214
View File
@@ -1,214 +0,0 @@
/****** RENAMED from xgetopt.cc to sc_getopt.cc ***********/
// XGetopt.cpp Version 1.2
//
// Author: Hans Dietrich
// hdietrich2@hotmail.com
//
// Description:
// XGetopt.cpp implements sc_getopt(), a function to parse command lines.
//
// History
// Version 1.2 - 2003 May 17
// - Added Unicode support
//
// Version 1.1 - 2002 March 10
// - Added example to XGetopt.cpp module header
//
// This software is released into the public domain.
// You are free to use it in any way you like.
//
// This software is provided "as is" with no expressed
// or implied warranty. I accept no liability for any
// damage or loss of business that this software may cause.
//
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
// if you are using precompiled headers then include this line:
//#include "stdafx.h"
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
// if you are not using precompiled headers then include these lines:
//#include <windows.h>
#include <stdio.h>
#include <string.h>
///////////////////////////////////////////////////////////////////////////////
#include "sc_getopt.h"
///////////////////////////////////////////////////////////////////////////////
//
// X G e t o p t . c p p
//
//
// NAME
// sc_getopt -- parse command line options
//
// SYNOPSIS
// int sc_getopt(int argc, char *argv[], char *optstring)
//
// extern char *sc_optarg;
// extern int sc_optind;
//
// DESCRIPTION
// The sc_getopt() function parses the command line arguments. Its
// arguments argc and argv are the argument count and array as
// passed into the application on program invocation. In the case
// of Visual C++ programs, argc and argv are available via the
// variables __argc and __argv (double underscores), respectively.
// sc_getopt returns the next option letter in argv that matches a
// letter in optstring. (Note: Unicode programs should use
// __targv instead of __argv. Also, all character and string
// literals should be enclosed in _T( ) ).
//
// optstring is a string of recognized option letters; if a letter
// is followed by a colon, the option is expected to have an argument
// that may or may not be separated from it by white space. sc_optarg
// is set to point to the start of the option argument on return from
// sc_getopt.
//
// Option letters may be combined, e.g., "-ab" is equivalent to
// "-a -b". Option letters are case sensitive.
//
// sc_getopt places in the external variable sc_optind the argv index
// of the next argument to be processed. sc_optind is initialized
// to 0 before the first call to sc_getopt.
//
// When all options have been processed (i.e., up to the first
// non-option argument), sc_getopt returns EOF, sc_optarg will point
// to the argument, and sc_optind will be set to the argv index of
// the argument. If there are no non-option arguments, sc_optarg
// will be set to NULL.
//
// The special option "--" may be used to delimit the end of the
// options; EOF will be returned, and "--" (and everything after it)
// will be skipped.
//
// RETURN VALUE
// For option letters contained in the string optstring, sc_getopt
// will return the option letter. sc_getopt returns a question mark (?)
// when it encounters an option letter not included in optstring.
// EOF is returned when processing is finished.
//
// BUGS
// 1) Long options are not supported.
// 2) The GNU double-colon extension is not supported.
// 3) The environment variable POSIXLY_CORRECT is not supported.
// 4) The + syntax is not supported.
// 5) The automatic permutation of arguments is not supported.
// 6) This implementation of sc_getopt() returns EOF if an error is
// encountered, instead of -1 as the latest standard requires.
//
// EXAMPLE
// BOOL CMyApp::ProcessCommandLine(int argc, char *argv[])
// {
// int c;
//
// while ((c = sc_getopt(argc, argv, _T("aBn:"))) != EOF)
// {
// switch (c)
// {
// case _T('a'):
// TRACE(_T("option a\n"));
// //
// // set some flag here
// //
// break;
//
// case _T('B'):
// TRACE( _T("option B\n"));
// //
// // set some other flag here
// //
// break;
//
// case _T('n'):
// TRACE(_T("option n: value=%d\n"), atoi(sc_optarg));
// //
// // do something with value here
// //
// break;
//
// case _T('?'):
// TRACE(_T("ERROR: illegal option %s\n"), argv[sc_optind-1]);
// return FALSE;
// break;
//
// default:
// TRACE(_T("WARNING: no handler for option %c\n"), c);
// return FALSE;
// break;
// }
// }
// //
// // check for non-option args here
// //
// return TRUE;
// }
//
///////////////////////////////////////////////////////////////////////////////
char * sc_optarg; // global argument pointer
int sc_optind = 0; // global argv index
int sc_getopt( int argc, char * argv[], char * optstring ) {
static char * next = NULL;
if( sc_optind == 0 ) {
next = NULL;
}
sc_optarg = NULL;
if( next == NULL || *next == '\0' ) {
if( sc_optind == 0 ) {
sc_optind++;
}
if( sc_optind >= argc || argv[sc_optind][0] != '-' || argv[sc_optind][1] == '\0' ) {
sc_optarg = NULL;
if( sc_optind < argc ) {
sc_optarg = argv[sc_optind];
}
return EOF;
}
if( strcmp( argv[sc_optind], "--" ) == 0 ) {
sc_optind++;
sc_optarg = NULL;
if( sc_optind < argc ) {
sc_optarg = argv[sc_optind];
}
return EOF;
}
next = argv[sc_optind];
next++; // skip past -
sc_optind++;
}
char c = *next++;
char * cp = strchr( optstring, c );
if( cp == NULL || c == ':' ) {
return '?';
}
cp++;
if( *cp == ':' ) {
if( *next != '\0' ) {
sc_optarg = next;
next = NULL;
} else if( sc_optind < argc ) {
sc_optarg = argv[sc_optind];
sc_optind++;
} else {
return '?';
}
}
return c;
}
-32
View File
@@ -1,32 +0,0 @@
/** \file sc_getopt.h
* this was xgetopt.h
* XGetopt.h Version 1.2
*
* Author: Hans Dietrich
* hdietrich2@hotmail.com
*
* This software is released into the public domain.
* You are free to use it in any way you like.
*
* This software is provided "as is" with no expressed
* or implied warranty. I accept no liability for any
* damage or loss of business that this software may cause.
*/
#ifndef XGETOPT_H
#define XGETOPT_H
#include "sc_export.h"
#ifdef __cplusplus
extern "C" {
#endif
extern SC_BASE_EXPORT int sc_optind, sc_opterr;
extern SC_BASE_EXPORT char * sc_optarg;
int SC_BASE_EXPORT sc_getopt( int argc, char * argv[], char * optstring );
#ifdef __cplusplus
}
#endif
#endif /* XGETOPT_H */
-405
View File
@@ -1,405 +0,0 @@
#define SC_MEMMGR_CC
#include "config.h"
#include "sc_memmgr.h"
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include <set>
#ifdef SC_MEMMGR_ENABLE_CHECKS
/**
sc_memmgr_error definition
*/
class sc_memmgr_error {
private:
std::string _srcfile;
unsigned int _srcline;
unsigned int _occurences;
public:
sc_memmgr_error( const std::string & file, const unsigned int line );
sc_memmgr_error( const sc_memmgr_error & rhs );
~sc_memmgr_error( void );
bool operator<( const sc_memmgr_error & rhs ) const;
std::string getsrcfile( void ) const;
unsigned int getsrcline( void ) const;
unsigned int getoccurences( void ) const;
};
typedef std::set<sc_memmgr_error> sc_memmgr_errors;
typedef std::set<sc_memmgr_error>::iterator sc_memmgr_error_iterator;
/**
sc_memmgr_record definition
*/
class sc_memmgr_record {
private:
void * _addr;
size_t _size;
std::string _srcfile;
unsigned int _srcline;
public:
sc_memmgr_record( void * addr, size_t size, const char * file, const unsigned int line );
sc_memmgr_record( void * addr );
sc_memmgr_record( const sc_memmgr_record & rhs );
~sc_memmgr_record( void );
bool operator<( const sc_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<sc_memmgr_record> sc_memmgr_records;
typedef std::set<sc_memmgr_record>::iterator sc_memmgr_record_iterator;
#endif /* SC_MEMMGR_ENABLE_CHECKS */
/**
sc_memmgr definition
*/
class sc_memmgr {
private:
#ifdef SC_MEMMGR_ENABLE_CHECKS
bool _record_insert_busy, _record_erase_busy;
// memory allocation/reallocation records, inserted at allocation, erased at deallocation.
sc_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 /* SC_MEMMGR_ENABLE_CHECKS */
protected:
public:
sc_memmgr( void );
~sc_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 );
};
/**
sc_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.
*/
sc_memmgr memmgr;
/**
c memory functions implementation
*/
extern "C" {
void * sc_malloc_fn( unsigned int size, const char * file, const int line ) {
return memmgr.allocate( size, file, line );
}
void * sc_calloc_fn( unsigned int count, unsigned int size, const char * file, const int line ) {
return memmgr.allocate( count * size, file, line );
}
void * sc_realloc_fn( void * addr, unsigned int size, const char * file, const int line ) {
return memmgr.reallocate( addr, size, file, line );
}
void sc_free_fn( void * addr ) {
memmgr.deallocate( addr, "", 0 );
}
}
/**
c++ memory operators implementation
*/
void * sc_operator_new( size_t size, const char * file, const int line ) {
return memmgr.allocate( size, file, line );
}
void sc_operator_delete( void * addr, const char * file, const int line ) {
memmgr.deallocate( addr, file, line );
}
void sc_operator_delete( void * addr ) {
memmgr.deallocate( addr, "", 0 );
}
/**
sc_memmgr implementation
*/
sc_memmgr::sc_memmgr( void ) {
#ifdef SC_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 /* SC_MEMMGR_ENABLE_CHECKS */
}
/**
Destructor:
sc_memmgr::~sc_memmgr(void)
Description:
The sc_memmgr destructor is used to check for memory leaks when enabled.
All records still present when sc_memmgr instance is destroyed can be considered as
memory leaks.
*/
sc_memmgr::~sc_memmgr( void ) {
#ifdef SC_MEMMGR_ENABLE_CHECKS
sc_memmgr_record_iterator irecord;
sc_memmgr_errors errors;
sc_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
fprintf( stderr, "sc_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 ++ ) {
sc_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
fprintf( stderr, "sc_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 /* SC_MEMMGR_ENABLE_CHECKS */
}
void * sc_memmgr::allocate( size_t size, const char * file, const int line ) {
void * addr;
// Allocate
addr = malloc( size );
if( addr == NULL ) {
// todo: error allocation failed
fprintf( stderr, "sc_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 sc_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 SC_MEMMGR_ENABLE_CHECKS
if( !_record_insert_busy ) {
// Store record for this allocation
_record_insert_busy = true;
_records.insert( sc_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 /* SC_MEMMGR_ENABLE_CHECKS */
return addr;
}
void * sc_memmgr::reallocate( void * addr, size_t size, const char * file, const int line ) {
#ifdef SC_MEMMGR_ENABLE_CHECKS
sc_memmgr_record_iterator record;
if( !_record_insert_busy ) {
// Find record of previous allocation/reallocation
record = _records.find( sc_memmgr_record( addr ) );
if( record == _records.end() ) {
// todo: error reallocating memory not allocated?
fprintf( stderr, "sc_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 /* SC_MEMMGR_ENABLE_CHECKS */
// Reallocate
addr = realloc( addr, size );
if( addr == NULL ) {
// todo: error reallocation failed
fprintf( stderr, "sc_memmgr error: Reallocation failed at %s line %d\n", file, line );
}
#ifdef SC_MEMMGR_ENABLE_CHECKS
if( !_record_insert_busy ) {
// Store record for this reallocation
_record_insert_busy = true;
_records.insert( sc_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 /* SC_MEMMGR_ENABLE_CHECKS */
return addr;
}
void sc_memmgr::deallocate( void * addr, const char * file, const int line ) {
#ifdef SC_MEMMGR_ENABLE_CHECKS
sc_memmgr_record_iterator record;
if( !_record_erase_busy ) {
// Find record of previous allocation/reallocation
record = _records.find( sc_memmgr_record( addr ) );
if( record == _records.end() ) {
// todo: error free called for not allocated memory?
fprintf( stderr, "sc_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;
}
}
#else
(void) file; // quell unused param warnings
(void) line;
#endif /* SC_MEMMGR_ENABLE_CHECKS */
// Deallocate
free( addr );
}
#ifdef SC_MEMMGR_ENABLE_CHECKS
/**
sc_memmgr_error implementation
*/
sc_memmgr_error::sc_memmgr_error( const std::string & file, const unsigned int line ) {
_srcfile = file;
_srcline = line;
_occurences = 1;
}
sc_memmgr_error::sc_memmgr_error( const sc_memmgr_error & rhs ) {
_srcfile = rhs._srcfile;
_srcline = rhs._srcline;
_occurences = rhs._occurences;
}
sc_memmgr_error::~sc_memmgr_error( void ) {
}
bool sc_memmgr_error::operator<( const sc_memmgr_error & rhs ) const {
if( _srcfile == rhs._srcfile ) {
return _srcline < rhs._srcline;
}
return _srcfile < rhs._srcfile;
}
std::string sc_memmgr_error::getsrcfile( void ) const {
return _srcfile;
}
unsigned int sc_memmgr_error::getsrcline( void ) const {
return _srcline;
}
unsigned int sc_memmgr_error::getoccurences( void ) const {
return _occurences;
}
/**
sc_memmgr_record implementation
*/
sc_memmgr_record::sc_memmgr_record( void * addr, size_t size, const char * file, const unsigned int line ) {
_addr = addr;
_size = size;
_srcfile = file;
_srcline = line;
}
sc_memmgr_record::sc_memmgr_record( void * addr ) {
_addr = addr;
_size = 0;
_srcfile = "";
_srcline = -1;
}
sc_memmgr_record::sc_memmgr_record( const sc_memmgr_record & rhs ) {
_addr = rhs._addr;
_size = rhs._size;
_srcfile = rhs._srcfile;
_srcline = rhs._srcline;
}
sc_memmgr_record::~sc_memmgr_record( void ) {
}
bool sc_memmgr_record::operator<( const sc_memmgr_record & rhs ) const {
return _addr < rhs._addr;
}
void * sc_memmgr_record::getaddr( void ) const {
return _addr;
}
size_t sc_memmgr_record::getsize( void ) const {
return _size;
}
std::string sc_memmgr_record::getsrcfile( void ) const {
return _srcfile;
}
unsigned int sc_memmgr_record::getsrcline( void ) const {
return _srcline;
}
#endif /* SC_MEMMGR_ENABLE_CHECKS */
-79
View File
@@ -1,79 +0,0 @@
#ifndef SC_MEMMGR_H
#define SC_MEMMGR_H
#include <sc_export.h>
#include <stdlib.h>
#if defined(SC_MEMMGR_ENABLE_CHECKS)
#ifdef __cplusplus
#include <stddef.h>
extern "C" {
#endif /* __cplusplus */
SC_BASE_EXPORT void * sc_malloc_fn( unsigned int size, const char * file, const int line );
SC_BASE_EXPORT void * sc_calloc_fn( unsigned int count, unsigned int size, const char * file, const int line );
SC_BASE_EXPORT void * sc_realloc_fn( void * addr, unsigned int size, const char * file, const int line );
SC_BASE_EXPORT void sc_free_fn( void * addr );
#ifdef __cplusplus
}
#endif /* __cplusplus */
#ifdef __cplusplus
SC_BASE_EXPORT void * sc_operator_new( size_t size, const char * file, const int line );
SC_BASE_EXPORT void sc_operator_delete( void * addr, const char * file, const int line );
SC_BASE_EXPORT void sc_operator_delete( void * addr );
#endif /* __cplusplus */
#ifndef SC_MEMMGR_CC
#define sc_malloc(size) sc_malloc_fn(size, __FILE__, __LINE__)
#define sc_calloc(count, size) sc_calloc_fn(count, size, __FILE__, __LINE__)
#define sc_realloc(addr, size) sc_realloc_fn(addr, size, __FILE__, __LINE__)
#define sc_free(addr) sc_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 sc_operator_new( size, file, line );
}
inline void * operator new[]( size_t size, const char * file, const int line ) throw (std::bad_alloc) {
return sc_operator_new( size, file, line );
}
inline void operator delete( void * addr, const char * file, const int line ) throw (std::bad_alloc) {
sc_operator_delete( addr, file, line );
}
inline void operator delete[]( void * addr, const char * file, const int line ) throw (std::bad_alloc) {
sc_operator_delete( addr, file, line );
}
inline void operator delete( void * addr ) throw () {
sc_operator_delete( addr );
}
inline void operator delete[]( void * addr ) throw () {
sc_operator_delete( addr );
}
#define new new(__FILE__, __LINE__)
#endif /* __cplusplus */
#endif /* SC_MEMMGR_CC */
#else
#define sc_malloc(size) malloc(size)
#define sc_calloc(count, size) calloc(count, size)
#define sc_realloc(addr, size) realloc(addr, size)
#define sc_free(addr) free(addr)
#endif /* SC_MEMMGR_ENABLE_CHECKS */
#endif /* SC_MEMMGR_H */
-32
View File
@@ -1,32 +0,0 @@
#define _XOPEN_SOURCE /* for S_IFDIR */
#include "sc_mkdir.h"
#include <sys/stat.h>
#include <sys/types.h>
#include <errno.h>
#ifdef _WIN32
# include <direct.h>
#endif /* _WIN32 */
/* cross-platform mkdir */
int sc_mkdir( const char * path ) {
#ifdef _WIN32
return mkdir( path );
#else
return mkdir( path, 0777 );
#endif /* _WIN32 */
}
/* return -1 if error, 0 if created, 1 if dir existed already */
int mkDirIfNone( const char * path ) {
struct stat s;
if( stat( path, &s ) != 0 ) {
if( errno == ENOENT ) {
return sc_mkdir( path );
}
} else if( s.st_mode & S_IFDIR ) {
return 1;
}
/* either stat returned an error other than ENOENT, or 'path' exists but isn't a dir */
return -1;
}
-15
View File
@@ -1,15 +0,0 @@
#ifndef SC_MKDIR
#define SC_MKDIR
#include <sc_export.h>
/** cross-platform mkdir() */
SC_BASE_EXPORT int sc_mkdir( const char * path );
/** create a dir 'path' if 'path' doesn't exist
* \return -1 if error, 0 if created, 1 if dir existed already
* if it returns -1, check errno
*/
SC_BASE_EXPORT int mkDirIfNone( const char * path );
#endif /* SC_MKDIR */
-39
View File
@@ -1,39 +0,0 @@
#ifndef __SC_STDIO_H
#define __SC_STDIO_H
/*
* https://stackoverflow.com/questions/2915672/snprintf-and-visual-studio-2010
* (NOTE: MSVC defines va_list as a char*, so this should be safe)
*/
#if defined(_MSC_VER) && _MSC_VER < 1900
#include <stdarg.h>
static __inline int
c99_vsnprintf(char *buffer, size_t sz, const char *format, va_list ap) {
int count = -1;
if (sz != 0)
count = _vsnprintf_s(buffer, sz, _TRUNCATE, format, ap);
if (count == -1)
count = _vscprintf(format, ap);
return count;
}
static __inline int
c99_snprintf(char *buffer, size_t sz, const char *format, ...) {
int count;
va_list ap;
va_start(ap, format);
count = c99_vsnprintf(buffer, sz, format, ap);
va_end(ap);
return count;
}
#endif
#endif /* __SC_STDIO_H */
-11
View File
@@ -1,11 +0,0 @@
#ifndef SC_STRTOULL_H
#define SC_STRTOULL_H
#include <limits.h>
#ifdef _WIN32
# define strtoull _strtoui64
# define ULLONG_MAX _UI64_MAX
#endif
#endif /* SC_STRTOULL_H */
+1 -2
View File
@@ -29,12 +29,11 @@ SET(SC_CLDAI_HDRS
include_directories(
${CMAKE_CURRENT_SOURCE_DIR}
${SC_SOURCE_DIR}/src/base
${SC_SOURCE_DIR}/src/clstepcore
${SC_SOURCE_DIR}/src/clutils
)
set(_libdeps steputils base)
set(_libdeps steputils)
if(BUILD_SHARED_LIBS)
SC_ADDLIB(stepdai SHARED SOURCES ${LIBSTEPDAI_SRCS} LINK_LIBRARIES ${_libdeps})
@@ -29,7 +29,6 @@
#include <memory.h>
#include <math.h>
#include "sc_memmgr.h"
#include "sdaiApplication_instance.h"
-1
View File
@@ -11,7 +11,6 @@
#include <sstream>
#include <sdai.h>
#include "sc_memmgr.h"
SDAI_Binary::SDAI_Binary( const char * str, int max ) {
content = std::string( str, max );
-1
View File
@@ -3,7 +3,6 @@
#include <math.h>
#include <sdai.h>
#include "sc_memmgr.h"
// to help ObjectCenter
#ifndef HAVE_MEMMOVE
-1
View File
@@ -3,7 +3,6 @@
//#include <EntityExtent.h>
#include <sdai.h>
#include "sc_memmgr.h"
SDAI_Entity_extent::SDAI_Entity_extent( )
: _definition( 0 ), _definition_name( 0 ), _owned_by( 0 ) {
-1
View File
@@ -27,7 +27,6 @@
#include <math.h>
#include <sdai.h>
#include "sc_memmgr.h"
/*
#include <EntityExtent.h>
-1
View File
@@ -1,6 +1,5 @@
#include <sdai.h>
#include "sc_memmgr.h"
/*
* NIST STEP Core Class Library
-1
View File
@@ -1,6 +1,5 @@
#include <sdai.h>
#include "sc_memmgr.h"
///////// SDAI_Model_contents_instances
-1
View File
@@ -24,7 +24,6 @@
* UArray implementation.
*/
#include <sdai.h>
#include "sc_memmgr.h"
// to help ObjectCenter
#ifndef HAVE_MEMMOVE
-1
View File
@@ -1,5 +1,4 @@
#include <sdai.h>
#include "sc_memmgr.h"
SDAI_sdaiObject::SDAI_sdaiObject() {
}
-1
View File
@@ -1,5 +1,4 @@
#include <sdai.h>
#include "sc_memmgr.h"
SDAI_Session_instance::SDAI_Session_instance() {
}
-1
View File
@@ -11,7 +11,6 @@
#include <sdai.h>
#include <sstream>
#include "sc_memmgr.h"
SDAI_String::SDAI_String( const char * str, size_t max ) {
if( !str ) {
+2 -3
View File
@@ -21,21 +21,20 @@ SET(SC_CLEDITOR_HDRS
include_directories(
${CMAKE_CURRENT_SOURCE_DIR}
${SC_SOURCE_DIR}/src/base
${SC_SOURCE_DIR}/src/cldai
${SC_SOURCE_DIR}/src/clstepcore
${SC_SOURCE_DIR}/src/clutils
)
if(BUILD_SHARED_LIBS)
SC_ADDLIB(stepeditor SHARED SOURCES ${LIBSTEPEDITOR_SRCS} LINK_LIBRARIES stepcore stepdai steputils base)
SC_ADDLIB(stepeditor SHARED SOURCES ${LIBSTEPEDITOR_SRCS} LINK_LIBRARIES stepcore stepdai steputils)
if(WIN32)
target_compile_definitions(stepeditor PRIVATE SC_EDITOR_DLL_EXPORTS)
endif()
endif()
if(BUILD_STATIC_LIBS)
SC_ADDLIB(stepeditor-static STATIC SOURCES ${LIBSTEPEDITOR_SRCS} LINK_LIBRARIES stepcore-static stepdai-static steputils-static base-static)
SC_ADDLIB(stepeditor-static STATIC SOURCES ${LIBSTEPEDITOR_SRCS} LINK_LIBRARIES stepcore-static stepdai-static steputils-static)
endif()
install(FILES ${SC_CLEDITOR_HDRS}
-2
View File
@@ -34,8 +34,6 @@
// void PushPastString (istream& in, std::string &s, ErrorDescriptor *err)
#include <STEPundefined.h>
#include "sc_memmgr.h"
/**
* \returns The new file name for the class.
* \param newName The file name to be set.
-1
View File
@@ -17,7 +17,6 @@
#include <cmath>
#include <cstring>
#include "sc_memmgr.h"
extern void HeaderSchemaInit( Registry & reg );
-1
View File
@@ -13,7 +13,6 @@ extern ofstream * logStream;
#include <ExpDict.h>
#include <STEPattribute.h>
#include <SdaiHeaderSchema.h>
#include "sc_memmgr.h"
Schema * s_header_section_schema = 0;
-1
View File
@@ -5,7 +5,6 @@
// regenerate it.
#include <SdaiHeaderSchema.h>
#include "sc_memmgr.h"
void HeaderInitSchemasAndEnts( Registry & reg ) {
Uniqueness_rule_ptr ur;
-1
View File
@@ -8,7 +8,6 @@
#include <ExpDict.h>
#include <STEPattribute.h>
#include <SdaiHeaderSchema.h>
#include "sc_memmgr.h"
void SdaiHEADER_SECTION_SCHEMAInit( Registry & reg ) {
header_section_schemat_time_stamp_text->ReferentType( t_sdaiSTRING );
-1
View File
@@ -5,7 +5,6 @@
// regenerate it.
#include <SdaiSchemaInit.h>
#include "sc_memmgr.h"
void HeaderSchemaInit( Registry & reg ) {
HeaderInitSchemasAndEnts( reg );
-1
View File
@@ -11,7 +11,6 @@
*/
#include <cmdmgr.h>
#include "sc_memmgr.h"
ReplicateLinkNode * ReplicateList::FindNode( MgrNode * mn ) {
ReplicateLinkNode * rln = ( ReplicateLinkNode * )GetHead();
+11 -5
View File
@@ -6,6 +6,7 @@ set( clLazyFile_SRCS
p21HeaderSectionReader.cc
sectionReader.cc
lazyP21DataSectionReader.cc
judy/src/judy.c
)
set( SC_CLLAZYFILE_HDRS
@@ -17,7 +18,13 @@ set( SC_CLLAZYFILE_HDRS
lazyInstMgr.h
lazyTypes.h
sectionReader.h
sectionReader.h
instMgrHelper.h
judy/src/judy.h
judy/src/judyLArray.h
judy/src/judyL2Array.h
judy/src/judySArray.h
judy/src/judyS2Array.h
)
include_directories(
@@ -26,11 +33,10 @@ include_directories(
${SC_SOURCE_DIR}/src/cldai
${SC_SOURCE_DIR}/src/clstepcore
${SC_SOURCE_DIR}/src/clutils
${SC_SOURCE_DIR}/src/base
${SC_SOURCE_DIR}/src/base/judy/src
${CMAKE_CURRENT_SOURCE_DIR}/judy/src
)
set(_libdeps stepcore stepdai steputils base stepeditor)
set(_libdeps stepcore stepdai steputils stepeditor)
if(BUILD_SHARED_LIBS)
SC_ADDLIB(steplazyfile SHARED SOURCES ${clLazyFile_SRCS} LINK_LIBRARIES ${_libdeps})
@@ -40,11 +46,11 @@ if(BUILD_SHARED_LIBS)
endif()
if(BUILD_STATIC_LIBS)
set(_libdeps stepcore-static stepdai-static steputils-static base-static stepeditor-static)
set(_libdeps stepcore-static stepdai-static steputils-static stepeditor-static)
SC_ADDLIB(steplazyfile-static STATIC SOURCES ${clLazyFile_SRCS} LINK_LIBRARIES ${_libdeps})
endif()
SC_ADDEXEC(lazy_test SOURCES lazy_test.cc LINK_LIBRARIES steplazyfile stepeditor NO_INSTALL)
SC_ADDEXEC(lazy_test SOURCES "lazy_test.cc;sc_benchmark.cc" LINK_LIBRARIES steplazyfile stepeditor NO_INSTALL)
target_compile_definitions(lazy_test PRIVATE NO_REGISTRY)
install(FILES ${SC_CLLAZYFILE_HDRS}
-1
View File
@@ -8,7 +8,6 @@
#include "lazyFileReader.h"
#include "sectionReader.h"
#include "lazyTypes.h"
#include "sc_memmgr.h"
#include "sc_export.h"
-1
View File
@@ -5,7 +5,6 @@
#include <iostream>
#include "sectionReader.h"
#include "lazyTypes.h"
#include "sc_memmgr.h"
#include "sc_export.h"
-2
View File
@@ -16,8 +16,6 @@
* #include "lazyP28DataSectionReader.h"
* #include "p28HeaderSectionReader.h"
*/
#include "sc_memmgr.h"
class lazyInstMgr;
class Registry;
class headerSectionReader;
-1
View File
@@ -10,7 +10,6 @@
#include "lazyTypes.h"
#include "Registry.h"
#include "sc_memmgr.h"
#include "sc_export.h"
#include "judyLArray.h"
@@ -3,7 +3,6 @@
#include "lazyDataSectionReader.h"
#include "lazyFileReader.h"
#include "sc_memmgr.h"
#include "sc_export.h"
class SC_LAZYFILE_EXPORT lazyP21DataSectionReader: public lazyDataSectionReader {
+1 -2
View File
@@ -1,7 +1,6 @@
#include "lazyInstMgr.h"
#include <sc_benchmark.h>
#include "./sc_benchmark.h"
#include "SdaiSchemaInit.h"
#include "sc_memmgr.h"
#include "config.h"
#ifndef NO_REGISTRY
-1
View File
@@ -2,7 +2,6 @@
#define P21HEADERSECTIONREADER_H
#include "headerSectionReader.h"
#include "sc_memmgr.h"
#include "sc_export.h"
class SC_LAZYFILE_EXPORT p21HeaderSectionReader: public headerSectionReader {
@@ -1,7 +1,6 @@
/// \file sc_benchmark.cc memory info, timers, etc for benchmarking
#include "sc_benchmark.h"
#include "sc_memmgr.h"
#include "./sc_benchmark.h"
#ifdef _WIN32
#include <windows.h>
@@ -2,14 +2,11 @@
#define SC_BENCHMARK_H
/// \file sc_benchmark.h memory info, timers, etc for benchmarking
#include "sc_export.h"
#ifdef __cplusplus
#include <iostream>
#include <iosfwd>
#include <string>
#include "sc_memmgr.h"
extern "C" {
#endif
@@ -23,7 +20,7 @@ extern "C" {
*
* not yet implemented for OSX or Windows.
*/
SC_BASE_EXPORT benchVals getMemAndTime( );
benchVals getMemAndTime( );
#ifdef __cplusplus
}
@@ -39,7 +36,7 @@ extern "C" {
* depends on getMemAndTime() above - may not work on all platforms.
*/
class SC_BASE_EXPORT benchmark {
class benchmark {
protected:
benchVals initialVals, laterVals;
#ifdef _MSC_VER
+6 -1
View File
@@ -5,9 +5,14 @@
#include <set>
#include <string>
#include <assert.h>
#include <limits.h>
#ifdef _WIN32
# define strtoull _strtoui64
# define ULLONG_MAX _UI64_MAX
#endif
#include "Registry.h"
#include "sc_strtoull.h"
#include "sdaiApplication_instance.h"
#include "read_func.h"
#include "SdaiSchemaInit.h"
-1
View File
@@ -4,7 +4,6 @@
#include <fstream>
#include <set>
#include "lazyTypes.h"
#include "sc_memmgr.h"
#include "sc_export.h"
#include "errordesc.h"
#include "STEPcomplex.h"
+1 -2
View File
@@ -125,13 +125,12 @@ set(SC_CLSTEPCORE_HDRS
include_directories(
${CMAKE_CURRENT_SOURCE_DIR}
${SC_SOURCE_DIR}/src/base
${SC_SOURCE_DIR}/src/cldai
${SC_SOURCE_DIR}/src/cleditor
${SC_SOURCE_DIR}/src/clutils
)
set(_libdeps steputils stepdai base)
set(_libdeps steputils stepdai)
if(BUILD_SHARED_LIBS)
SC_ADDLIB(stepcore SHARED SOURCES ${LIBSTEPCORE_SRCS} LINK_LIBRARIES ${_libdeps})
-1
View File
@@ -11,7 +11,6 @@
#include <ExpDict.h>
#include <Registry.h>
#include "sc_memmgr.h"
/* these may be shared between multiple Registry instances, so don't create/destroy in Registry ctor/dtor
* Name, FundamentalType, Originating Schema, Description */
-1
View File
@@ -17,7 +17,6 @@
#include <STEPattribute.h>
#include <instmgr.h>
#include <ExpDict.h>
#include "sc_memmgr.h"
/**
-1
View File
@@ -19,7 +19,6 @@
#include <STEPaggregate.h>
#include <ExpDict.h>
#include <sdai.h>
#include "sc_memmgr.h"
// REAL_NUM_PRECISION is defined in STEPattribute.h, and is also used
// in aggregate real handling (STEPaggregate.cc) -- IMS 6 Jun 95
-1
View File
@@ -12,7 +12,6 @@
#include <STEPattributeList.h>
#include <STEPattribute.h>
#include "sc_memmgr.h"
AttrListNode::AttrListNode( STEPattribute * a ) {
attr = a;
-1
View File
@@ -6,7 +6,6 @@
#include <STEPattribute.h>
#include <STEPaggregate.h>
#include <sstream>
#include "sc_memmgr.h"
extern const char *
ReadStdKeyword( istream & in, std::string & buf, int skipInitWS );
-1
View File
@@ -5,7 +5,6 @@
#include <STEPinvAttrList.h>
#include <ExpDict.h>
#include "sc_memmgr.h"
invAttrListNodeI::invAttrListNodeI(Inverse_attribute* a, setterI_t s, getterI_t g): invAttrListNode(a), set( s ), get( g ) {}
invAttrListNodeA::invAttrListNodeA(Inverse_attribute* a, setterA_t s, getterA_t g): invAttrListNode(a), set( s ), get( g ) {}
-1
View File
@@ -13,7 +13,6 @@
#include <stdio.h> // to get the BUFSIZ #define
#include <STEPattribute.h>
#include <STEPundefined.h>
#include "sc_memmgr.h"
/** \class SCLundefined
** helper functions for reading unknown types
-1
View File
@@ -11,7 +11,6 @@
*/
#include <SingleLinkList.h>
#include "sc_memmgr.h"
#include <iostream>
-1
View File
@@ -12,7 +12,6 @@
*****************************************************************************/
#include "complexSupport.h"
#include "sc_memmgr.h"
/**
* Inserts a new ComplexList to our list. The ComplexLists are ordered by
-1
View File
@@ -11,7 +11,6 @@
*****************************************************************************/
#include "complexSupport.h"
#include "sc_memmgr.h"
/**
* Destructor for ComplexList.
-1
View File
@@ -18,7 +18,6 @@
#include <dispnode.h>
#include <dispnodelist.h>
#include "sc_memmgr.h"
// define this to be the name of the display object
class StepEntityEditor;
-1
View File
@@ -19,7 +19,6 @@
#include <mgrnodelist.h>
#include <dispnode.h>
#include <dispnodelist.h>
#include "sc_memmgr.h"
void DisplayNodeList::Remove( GenericNode * node ) {
GenNodeList::Remove( node );
-1
View File
@@ -14,7 +14,6 @@
*****************************************************************************/
#include "complexSupport.h"
#include "sc_memmgr.h"
/**
* Returns the number of EntLists in this's list (EntList->next, next->next
-1
View File
@@ -12,7 +12,6 @@
*****************************************************************************/
#include "complexSupport.h"
#include "sc_memmgr.h"
/**
* Given a list of entity names, creates a sorted linked list of EntNodes
-1
View File
@@ -18,7 +18,6 @@
#include <sdai.h>
#include <instmgr.h>
#include "sc_memmgr.h"
///////////////////////////////////////////////////////////////////////////////
// debug_level >= 2 => tells when a command is chosen
-1
View File
@@ -14,7 +14,6 @@
*****************************************************************************/
#include "complexSupport.h"
#include "sc_memmgr.h"
/**
* Loops through descendants of this, invoking their matchOR functions.
-1
View File
@@ -22,7 +22,6 @@
#include <sdai.h>
#include <iostream>
#include "sc_memmgr.h"
void * MgrNode::SEE() {
return ( di ? di->SEE() : 0 );
-1
View File
@@ -37,7 +37,6 @@ static int PrintFunctionTrace = 2;
#include <sdai.h>
#include <string.h> // to get bcopy() - ANSI
#include "sc_memmgr.h"
//////////////////////////////////////////////////////////////////////////////
// class MgrNodeArray member functions
-1
View File
@@ -16,7 +16,6 @@
#include <mgrnodelist.h>
#include <dispnode.h>
#include <dispnodelist.h>
#include "sc_memmgr.h"
MgrNodeList::MgrNodeList( stateEnum type ) : GenNodeList( new MgrNode() ) {
// if(debug_level >= PrintFunctionTrace)
-1
View File
@@ -14,7 +14,6 @@
*****************************************************************************/
#include "complexSupport.h"
#include "sc_memmgr.h"
/**
* Deletes the childList of this, before this is deleted.
-1
View File
@@ -1,5 +1,4 @@
#include <needFunc.h>
#include "sc_memmgr.h"
///////////////////////////////////////////////////////////////////////////////
// Function defined as a stub (necessary to use the scl)
-1
View File
@@ -11,7 +11,6 @@
*****************************************************************************/
#include "complexSupport.h"
#include "sc_memmgr.h"
/**
* Checks if we match the nodes of ents. If only one unmarked is left
-1
View File
@@ -11,7 +11,6 @@
*****************************************************************************/
#include "complexSupport.h"
#include "sc_memmgr.h"
/**
* Check if we matched nm. We have two possibilities here: If we have a
-1
View File
@@ -8,7 +8,6 @@
*****************************************************************************/
#include "complexSupport.h"
#include "sc_memmgr.h"
// Local function prototypes:
static char * joinText( JoinType, char * );
-1
View File
@@ -5,7 +5,6 @@
#include <read_func.h>
#include <STEPattribute.h>
#include "Str.h"
#include "sc_memmgr.h"
const int RealNumPrecision = REAL_NUM_PRECISION;
-1
View File
@@ -2,7 +2,6 @@
#include <cfloat>
#include <sdai.h>
#include "sc_memmgr.h"
const char * SCLversion = "STEPcode, github.com/stepcode/stepcode";
+4 -5
View File
@@ -3,7 +3,6 @@ CMAKE_MINIMUM_REQUIRED(VERSION 3.12)
include_directories(
${SC_SOURCE_DIR}/src/cldai ${SC_SOURCE_DIR}/src/cleditor
${SC_SOURCE_DIR}/src/clutils ${SC_SOURCE_DIR}/src/base
${SC_SOURCE_DIR}/src/clstepcore
)
@@ -21,10 +20,10 @@ function(add_stepcore_test name libs)
set_tests_properties(test_${name} PROPERTIES LABELS cpp_unit_stepcore DEPENDS build_cpp_${name})
endfunction(add_stepcore_test name libs)
add_stepcore_test("SupertypesIterator" "stepcore;steputils;stepeditor;stepdai;base") #all these libs are necessary?
add_stepcore_test("operators_STEPattribute" "stepcore;steputils;stepeditor;stepdai;base")
add_stepcore_test("operators_SDAI_Select" "stepcore;steputils;stepeditor;stepdai;base")
add_stepcore_test("null_attr" "stepcore;steputils;stepeditor;stepdai;base")
add_stepcore_test("SupertypesIterator" "stepcore;steputils;stepeditor;stepdai") #all these libs are necessary?
add_stepcore_test("operators_STEPattribute" "stepcore;steputils;stepeditor;stepdai")
add_stepcore_test("operators_SDAI_Select" "stepcore;steputils;stepeditor;stepdai")
add_stepcore_test("null_attr" "stepcore;steputils;stepeditor;stepdai")
# Local Variables:
# tab-width: 8
-1
View File
@@ -12,7 +12,6 @@
*****************************************************************************/
#include "complexSupport.h"
#include "sc_memmgr.h"
// Local function prototypes:
static EntList * firstCandidate( EntList * );

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