Skip to content

Commit 7dbda20

Browse files
starseekercshorler
authored andcommitted
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.
1 parent fdf271c commit 7dbda20

154 files changed

Lines changed: 831 additions & 1218 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CMakeLists.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,6 @@ option(BUILD_STATIC_LIBS "Build static libraries" OFF)
120120
option(SC_PYTHON_GENERATOR "Compile exp2python" ON)
121121
option(SC_CPP_GENERATOR "Compile exp2cxx" ON)
122122

123-
option(SC_MEMMGR_ENABLE_CHECKS "Enable sc_memmgr's memory leak detection" OFF)
124123
option(SC_TRACE_FPRINTF "Enable extra comments in generated code so the code's source in exp2cxx may be located" OFF)
125124

126125
option(SC_ENABLE_COVERAGE "Enable code coverage test" OFF)
@@ -189,7 +188,6 @@ include_directories(
189188
${SC_BINARY_DIR}/include
190189
)
191190

192-
add_subdirectory(src/base)
193191
add_subdirectory(src/express)
194192
add_subdirectory(src/exppp)
195193
add_subdirectory(src/exp2cxx)

cmake/SC_CXX_schema_macros.cmake

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,16 +27,16 @@ endmacro(P21_TESTS sfile)
2727
# create p21read_sdai_*, lazy_sdai_*, any exes listed in SC_SDAI_ADDITIONAL_EXES_SRCS
2828
macro(SCHEMA_EXES)
2929
RELATIVE_PATH_TO_TOPLEVEL(${CMAKE_CURRENT_SOURCE_DIR} RELATIVE_PATH_COMPONENT)
30-
SC_ADDEXEC(p21read_${PROJECT_NAME} SOURCES "${RELATIVE_PATH_COMPONENT}/src/test/p21read/p21read.cc" LINK_LIBRARIES ${PROJECT_NAME} stepdai stepcore stepeditor steputils base TESTABLE)
30+
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)
3131
if(NOT WIN32)
32-
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)
32+
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)
3333
endif(NOT WIN32)
3434

3535
#add user-defined executables
3636
foreach(src ${SC_SDAI_ADDITIONAL_EXES_SRCS})
3737
get_filename_component(name ${src} NAME_WE)
3838
get_filename_component(path ${src} ABSOLUTE)
39-
SC_ADDEXEC(${name}_${PROJECT_NAME} SOURCES ${src} LINK_LIBRARIES ${PROJECT_NAME} stepdai stepcore stepeditor steputils base TESTABLE)
39+
SC_ADDEXEC(${name}_${PROJECT_NAME} SOURCES ${src} LINK_LIBRARIES ${PROJECT_NAME} stepdai stepcore stepeditor steputils TESTABLE)
4040
#set_target_properties(${name}_${PROJECT_NAME} PROPERTIES COMPILE_FLAGS "${${PROJECT_NAME}_COMPILE_FLAGS} -I${path}")
4141
endforeach(src ${SC_SDAI_ADDITIONAL_EXES_SRCS})
4242
ENDMACRO(SCHEMA_EXES)
@@ -89,12 +89,12 @@ macro(SCHEMA_TARGETS expFile schemaName sourceFiles)
8989
)
9090
include_directories(
9191
${CMAKE_CURRENT_SOURCE_DIR} ${SC_SOURCE_DIR}/src/cldai ${SC_SOURCE_DIR}/src/cleditor
92-
${SC_SOURCE_DIR}/src/clutils ${SC_SOURCE_DIR}/src/clstepcore ${SC_SOURCE_DIR}/src/base
93-
${SC_SOURCE_DIR}/src/base/judy/src
92+
${SC_SOURCE_DIR}/src/clutils ${SC_SOURCE_DIR}/src/clstepcore ${SC_SOURCE_DIR}/src/cllazyfile
93+
${SC_SOURCE_DIR}/src/cllazyfile/judy/src
9494
)
9595
# if testing is enabled, "TESTABLE" sets property EXCLUDE_FROM_ALL and prevents installation
9696
if(BUILD_SHARED_LIBS)
97-
SC_ADDLIB(${PROJECT_NAME} SHARED SOURCES ${sourceFiles} LINK_LIBRARIES stepdai stepcore stepeditor steputils base TESTABLE)
97+
SC_ADDLIB(${PROJECT_NAME} SHARED SOURCES ${sourceFiles} LINK_LIBRARIES stepdai stepcore stepeditor steputils TESTABLE)
9898
add_dependencies(${PROJECT_NAME} generate_cpp_${PROJECT_NAME})
9999
if(WIN32)
100100
target_compile_definitions("${PROJECT_NAME}" PRIVATE SC_SCHEMA_DLL_EXPORTS)
@@ -111,7 +111,7 @@ macro(SCHEMA_TARGETS expFile schemaName sourceFiles)
111111
endif()
112112
113113
if($CACHE{SC_BUILD_STATIC_LIBS})
114-
SC_ADDLIB(${PROJECT_NAME}-static STATIC SOURCES ${sourceFiles} LINK_LIBRARIES stepdai-static stepcore-static stepeditor-static steputils-static base-static TESTABLE)
114+
SC_ADDLIB(${PROJECT_NAME}-static STATIC SOURCES ${sourceFiles} LINK_LIBRARIES stepdai-static stepcore-static stepeditor-static steputils-static TESTABLE)
115115
add_dependencies(${PROJECT_NAME}-static generate_cpp_${PROJECT_NAME})
116116
target_compile_defines("${PROJECT_NAME}-static" PRIVATE SC_STATIC)
117117
if(MSVC)

cmake/schema_scanner/CMakeLists.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ set(SC_BINARY_DIR ${SC_BUILDDIR})
1616
include(${CMAKE_CURRENT_SOURCE_DIR}/../SC_Outdirs.cmake)
1717

1818
set(schema_scanner_src
19-
${SC_ROOT}/src/base/sc_mkdir.c
2019
${SC_ROOT}/src/exp2cxx/genCxxFilenames.c
2120
${SC_ROOT}/src/exp2cxx/class_strings.c
2221
${SC_ROOT}/src/express/generated/expparse.c
@@ -52,7 +51,6 @@ include_directories(
5251
${SC_ROOT}/include/
5352
${SC_ROOT}/src/express/
5453
${SC_ROOT}/src/express/generated
55-
${SC_ROOT}/src/base
5654
${SC_ROOT}/src/exp2cxx
5755
${SC_BUILDDIR}/include
5856
)

cmake/schema_scanner/schemaScanner.cc

Lines changed: 43 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14,20 +14,25 @@
1414
*/
1515

1616
extern "C" {
17-
# include "expparse.h"
18-
# include "expscan.h"
19-
# include "express/scope.h"
20-
# include "genCxxFilenames.h"
21-
# include "sc_mkdir.h"
22-
23-
# include <string.h>
24-
25-
# ifdef _WIN32
26-
# include <direct.h>
27-
# define getcwd _getcwd
28-
# else
29-
# include <unistd.h>
30-
# endif
17+
#define _XOPEN_SOURCE /* for S_IFDIR */
18+
19+
#include <sys/stat.h>
20+
#include <sys/types.h>
21+
#include <errno.h>
22+
23+
#include "expparse.h"
24+
#include "expscan.h"
25+
#include "express/scope.h"
26+
#include "genCxxFilenames.h"
27+
28+
#include <string.h>
29+
30+
#ifdef _WIN32
31+
# include <direct.h>
32+
# define getcwd _getcwd
33+
#else
34+
# include <unistd.h>
35+
#endif
3136
}
3237

3338
#include <string>
@@ -125,6 +130,30 @@ string makeShortName( const char * longName ) {
125130
return filename;
126131
}
127132

133+
/* cross-platform mkdir */
134+
int sc_mkdir( const char * path ) {
135+
#ifdef _WIN32
136+
return mkdir( path );
137+
#else
138+
return mkdir( path, 0777 );
139+
#endif /* _WIN32 */
140+
}
141+
142+
/* return -1 if error, 0 if created, 1 if dir existed already */
143+
static int mkDirIfNone( const char * path ) {
144+
struct stat s;
145+
if( stat( path, &s ) != 0 ) {
146+
if( errno == ENOENT ) {
147+
return sc_mkdir( path );
148+
}
149+
} else if( s.st_mode & S_IFDIR ) {
150+
return 1;
151+
}
152+
/* either stat returned an error other than ENOENT, or 'path' exists but isn't a dir */
153+
return -1;
154+
}
155+
156+
128157
/** write a CMakeLists.txt file for the schema; print its directory to stdout for CMake's add_subdirectory() command */
129158
void writeLists( const char * schemaName, stringstream & eh, stringstream & ei, int ecount,
130159
stringstream & th, stringstream & ti, int tcount ) {

example/ap203min/CMakeLists.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,14 +51,13 @@ endif(NOT EXISTS ${SCHEMA_FILE})
5151

5252
get_filename_component(SCHEMA_SN ${SCHEMA_FILE} NAME)
5353
string(REGEX REPLACE "\(.*\).[Ee][Xx][Pp]" "sdai_\\1" SCHEMA_LINK_NAME ${SCHEMA_SN})
54-
set(STEPCODE_LIBRARIES base stepcore stepeditor stepdai steputils ${SCHEMA_LINK_NAME})
54+
set(STEPCODE_LIBRARIES stepcore stepeditor stepdai steputils ${SCHEMA_LINK_NAME})
5555

5656
# Add STEPCode project to CMake build.
5757
add_subdirectory(${STEPCODE_ROOT_DIR} "${CMAKE_CURRENT_BINARY_DIR}/sc" EXCLUDE_FROM_ALL)
5858

5959
# Set up STEPcode include directories.
6060
set(STEPCODE_INCLUDE_DIR
61-
${STEPCODE_ROOT_DIR}/src/base
6261
${STEPCODE_ROOT_DIR}/src/clstepcore
6362
${STEPCODE_ROOT_DIR}/src/cldai
6463
${STEPCODE_ROOT_DIR}/src/clutils

example/ap203min/ExternalProjectBuild/CMakeLists.txt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ INCLUDE( External_STEPCode )
1919

2020
IF(NOT WIN32)
2121
set( STEPCODE_LIBRARIES
22-
${STEPCODE_INSTALL_DIR}/lib/libbase.a
2322
${STEPCODE_INSTALL_DIR}/lib/libstepcore.a
2423
${STEPCODE_INSTALL_DIR}/lib/libstepeditor.a
2524
${STEPCODE_INSTALL_DIR}/lib/libstepdai.a
@@ -28,7 +27,6 @@ IF(NOT WIN32)
2827
)
2928
ELSE()
3029
set( STEPCODE_LIBRARIES
31-
${STEPCODE_INSTALL_DIR}/lib/libbase.lib
3230
${STEPCODE_INSTALL_DIR}/lib/libstepcore.lib
3331
${STEPCODE_INSTALL_DIR}/lib/libstepeditor.lib
3432
${STEPCODE_INSTALL_DIR}/lib/libstepdai.lib
@@ -44,7 +42,6 @@ MESSAGE( STATUS "STEPCODE_INSTALL_DIR: " ${STEPCODE_INSTALL_DIR} )
4442

4543
set( STEPCODE_INCLUDE_DIR
4644
${STEPCODE_INSTALL_DIR}/include/stepcode
47-
${STEPCODE_INSTALL_DIR}/include/stepcode/base
4845
${STEPCODE_INSTALL_DIR}/include/stepcode/clstepcore
4946
${STEPCODE_INSTALL_DIR}/include/stepcode/cldai
5047
${STEPCODE_INSTALL_DIR}/include/stepcode/clutils

example/ap203min/include/config.h.in

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
#cmakedefine HAVE_IO_H 1
1616

1717
#cmakedefine SC_TRACE_FPRINTF 1
18-
#cmakedefine SC_MEMMGR_ENABLE_CHECKS 1
1918

2019
#cmakedefine HAVE_ABS 1
2120
#cmakedefine HAVE_MEMCPY 1

include/config.h.in

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
#cmakedefine HAVE_IO_H 1
1616

1717
#cmakedefine SC_TRACE_FPRINTF 1
18-
#cmakedefine SC_MEMMGR_ENABLE_CHECKS 1
1918

2019
#cmakedefine HAVE_ABS 1
2120
#cmakedefine HAVE_MEMCPY 1

include/express/basic.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,5 +96,8 @@
9696
typedef void ( *voidFuncptr )();
9797
typedef int ( *intFuncptr )();
9898

99+
/* Option index - can we get rid of this? */
100+
extern SC_EXPRESS_EXPORT int sc_optind;
101+
99102
#endif /* BASIC_H */
100103

src/base/CMakeLists.txt

Lines changed: 0 additions & 72 deletions
This file was deleted.

0 commit comments

Comments
 (0)