Commit 2f211c6b authored by Dick Hollenbeck's avatar Dick Hollenbeck

++all:

  * TokenList2DsnLexer.cmake now wraps each token enum in its own namespace. It
    also no longer setup of the "using" directive in the header file, which was
    bad behavior.  C++ enum values will have name collisions unless the enums
    themselves are different namespaces.
++new:
  * Sweet library is now a DSO/DLL.
  * Brought in SWIG to do a wrap of the Sweet DSO/DLL for unit testing
    and scripting.  The SWIG DSO/DLLs are built separate from the Sweet DSO/DLL
    and are also optional.
parent e7a75e0e
...@@ -4,6 +4,19 @@ KiCad ChangeLog 2010 ...@@ -4,6 +4,19 @@ KiCad ChangeLog 2010
Please add newer entries at the top, list the date and your name with Please add newer entries at the top, list the date and your name with
email address. email address.
2011-Jan-17 UPDATE Dick Hollenbeck <dick@softplc.com>
================================================================================
++all:
* TokenList2DsnLexer.cmake now wraps each token enum in its own namespace. It
also no longer setup of the "using" directive in the header file, which was
bad behavior. C++ enum values will have name collisions unless the enums
themselves are different namespaces.
++new:
* Sweet library is now a DSO/DLL.
* Brought in SWIG to do a wrap of the Sweet DSO/DLL for unit testing
and scripting. The SWIG DSO/DLLs are built separate from the Sweet DSO/DLL
and are also optional.
2011-Jan-1 UPDATE Dick Hollenbeck <dick@softplc.com> 2011-Jan-1 UPDATE Dick Hollenbeck <dick@softplc.com>
================================================================================ ================================================================================
++new: ++new:
......
This diff is collapsed.
...@@ -5,8 +5,7 @@ ...@@ -5,8 +5,7 @@
#include "fctsys.h" #include "fctsys.h"
#include "macros.h" #include "macros.h"
using namespace DSN; // enum TFIELD_T is in this namespace using namespace TFIELD_T;
wxString TEMPLATE_FIELDNAME::GetDefaultFieldName( int aFieldNdx ) wxString TEMPLATE_FIELDNAME::GetDefaultFieldName( int aFieldNdx )
{ {
...@@ -48,7 +47,7 @@ void TEMPLATE_FIELDNAME::Format( OUTPUTFORMATTER* out, int nestLevel ) const thr ...@@ -48,7 +47,7 @@ void TEMPLATE_FIELDNAME::Format( OUTPUTFORMATTER* out, int nestLevel ) const thr
void TEMPLATE_FIELDNAME::Parse( TEMPLATE_FIELDNAMES_LEXER* in ) throw( IO_ERROR ) void TEMPLATE_FIELDNAME::Parse( TEMPLATE_FIELDNAMES_LEXER* in ) throw( IO_ERROR )
{ {
TFIELD_T tok; T tok;
in->NeedLEFT(); // begin (name ...) in->NeedLEFT(); // begin (name ...)
...@@ -97,9 +96,10 @@ void TEMPLATES::Format( OUTPUTFORMATTER* out, int nestLevel ) const throw( IO_ER ...@@ -97,9 +96,10 @@ void TEMPLATES::Format( OUTPUTFORMATTER* out, int nestLevel ) const throw( IO_ER
out->Print( 0, ")\n" ); out->Print( 0, ")\n" );
} }
void TEMPLATES::Parse( TEMPLATE_FIELDNAMES_LEXER* in ) throw( IO_ERROR ) void TEMPLATES::Parse( TEMPLATE_FIELDNAMES_LEXER* in ) throw( IO_ERROR )
{ {
TFIELD_T tok; T tok;
while( (tok = in->NextTok() ) != T_RIGHT && tok != T_EOF ) while( (tok = in->NextTok() ) != T_RIGHT && tok != T_EOF )
{ {
......
...@@ -9,9 +9,9 @@ if( STAND_ALONE ) ...@@ -9,9 +9,9 @@ if( STAND_ALONE )
set( PROJECT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../ ) set( PROJECT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../ )
# Path to local CMake modules. # Path to local CMake modules.
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/CMakeModules) set( CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/CMakeModules )
include(CheckFindPackageResult) include( CheckFindPackageResult )
find_package(Doxygen) find_package(Doxygen)
...@@ -60,51 +60,78 @@ endif() ...@@ -60,51 +60,78 @@ endif()
include_directories( ${CMAKE_CURRENT_SOURCE_DIR} ) include_directories( ${CMAKE_CURRENT_SOURCE_DIR} )
#=====<on standby until unit testing infrastructure>============================ #=====<on standby for possible C++ unit testing>================================
if( false ) if( false )
add_executable( test_dir_lib_source add_executable( test_dir_lib_source
sch_dir_lib_source.cpp sch_dir_lib_source.cpp
) )
target_link_libraries( test_dir_lib_source ${wxWidgets_LIBRARIES} ) target_link_libraries( test_dir_lib_source ${wxWidgets_LIBRARIES} )
add_executable( test_sch_part sch_part.cpp ) add_executable( test_sch_part sch_part.cpp )
target_link_libraries( test_sch_part ${wxWidgets_LIBRARIES} ) target_link_libraries( test_sch_part ${wxWidgets_LIBRARIES} )
add_executable( test_lpid add_executable( test_lpid
sch_lpid.cpp sch_lpid.cpp
) )
target_link_libraries( test_lpid ${wxWidgets_LIBRARIES} ) target_link_libraries( test_lpid ${wxWidgets_LIBRARIES} )
endif( false ) endif( false )
#=====</on standby until unit testing infrastructure>=========================== #=====</on standby for possible C++ unit testing>===============================
make_lexer(
${CMAKE_CURRENT_SOURCE_DIR}/sch_lib_table.keywords
${CMAKE_CURRENT_SOURCE_DIR}/sch_lib_table_lexer.h
${CMAKE_CURRENT_SOURCE_DIR}/sch_lib_table_keywords.cpp
LT
)
make_lexer(
${CMAKE_CURRENT_SOURCE_DIR}/sweet.keywords
${CMAKE_CURRENT_SOURCE_DIR}/sweet_lexer.h
${CMAKE_CURRENT_SOURCE_DIR}/sweet_keywords.cpp
PR
)
add_executable( test_sch_lib_table add_library( sweet SHARED
sch_lib_table.cpp sch_lib_table.cpp
sch_lib_table_keywords.cpp sch_lib_table_keywords.cpp
sch_lib.cpp sch_lib.cpp
sch_lpid.cpp sch_lpid.cpp
filter_reader.cpp
sch_dir_lib_source.cpp sch_dir_lib_source.cpp
sch_part.cpp sch_part.cpp
sweet_keywords.cpp sweet_keywords.cpp
${PROJECT_SOURCE_DIR}/common/richio.cpp ${PROJECT_SOURCE_DIR}/common/richio.cpp
${PROJECT_SOURCE_DIR}/common/dsnlexer.cpp ${PROJECT_SOURCE_DIR}/common/dsnlexer.cpp
) )
target_link_libraries( test_sch_lib_table ${wxWidgets_LIBRARIES} ) target_link_libraries( sweet ${wxWidgets_LIBRARIES} )
make_lexer( #=====<USE_SWIG>============================================================
${CMAKE_CURRENT_SOURCE_DIR}/sch_lib_table.keywords # if you want a Python scripting layer on top for unit testing or driving.
${CMAKE_CURRENT_SOURCE_DIR}/sch_lib_table_lexer.h # reference: http://www.swig.org/Doc1.3/Introduction.html#Introduction_build_system
${CMAKE_CURRENT_SOURCE_DIR}/sch_lib_table_keywords.cpp
ELT_T option( USE_SWIG "Use SWIG to build a python scripting interface (default ON)." ON)
) if( USE_SWIG )
find_package( SWIG REQUIRED )
include( ${SWIG_USE_FILE} )
# first install "python-dev" linux package for this:
find_package( PythonLibs )
include_directories( ${PYTHON_INCLUDE_PATH} )
set( CMAKE_SWIG_FLAGS "" )
set_source_files_properties( sweet.i PROPERTIES CPLUSPLUS ON )
#set_source_files_properties( sweet.i PROPERTIES SWIG_FLAGS "-includeall" )
swig_add_module( sweet python sweet.i )
swig_link_libraries( sweet ${PYTHON_LIBRARIES} sweet )
# @todo need a separate interface for each DSNLEXER
endif()
make_lexer(
${CMAKE_CURRENT_SOURCE_DIR}/sweet.keywords
${CMAKE_CURRENT_SOURCE_DIR}/sweet_lexer.h
${CMAKE_CURRENT_SOURCE_DIR}/sweet_keywords.cpp
PART_T
)
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
#include <sch_lib_table.h> #include <sch_lib_table.h>
#include <sch_dir_lib_source.h> #include <sch_dir_lib_source.h>
//using namespace std; // screws up Doxygen //using namespace std; // screws up Doxygen
using namespace SCH; using namespace SCH;
...@@ -55,7 +56,7 @@ void LIB_TABLE::Parse( SCH_LIB_TABLE_LEXER* in ) throw( IO_ERROR ) ...@@ -55,7 +56,7 @@ void LIB_TABLE::Parse( SCH_LIB_TABLE_LEXER* in ) throw( IO_ERROR )
note: "(lib_table" has already been read in. note: "(lib_table" has already been read in.
*/ */
ELT_T tok; T tok;
while( ( tok = in->NextTok() ) != T_RIGHT ) while( ( tok = in->NextTok() ) != T_RIGHT )
{ {
...@@ -339,7 +340,7 @@ bool LIB_TABLE::InsertRow( std::auto_ptr<ROW>& aRow, bool doReplace ) ...@@ -339,7 +340,7 @@ bool LIB_TABLE::InsertRow( std::auto_ptr<ROW>& aRow, bool doReplace )
} }
#if 1 && defined(DEBUG) #if 0 && defined(DEBUG)
// build this with a Debug CMAKE_BUILD_TYPE // build this with a Debug CMAKE_BUILD_TYPE
......
...@@ -29,7 +29,6 @@ ...@@ -29,7 +29,6 @@
#include <boost/ptr_container/ptr_map.hpp> #include <boost/ptr_container/ptr_map.hpp>
#include <sch_lib.h> #include <sch_lib.h>
//#include <sch_lpid.h>
class SCH_LIB_TABLE_LEXER; // outside namespace SCH, since make_lexer() Functions.cmake can't do namespace class SCH_LIB_TABLE_LEXER; // outside namespace SCH, since make_lexer() Functions.cmake can't do namespace
class OUTPUTFORMATTER; class OUTPUTFORMATTER;
......
...@@ -140,7 +140,7 @@ public: ...@@ -140,7 +140,7 @@ public:
/// @param me = ja mir, the object getting stuffed, from its perspective /// @param me = ja mir, the object getting stuffed, from its perspective
void parsePart( PART* me ) void parsePart( PART* me )
{ {
PART_T tok; T tok;
#if 0 #if 0
// Be flexible regarding the starting point of the stream. // Be flexible regarding the starting point of the stream.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment