Commit 8384d7e0 authored by Dick Hollenbeck's avatar Dick Hollenbeck

implement some of the DIR_LIB_SOURCE Read*() functions

parent 80f21358
......@@ -212,6 +212,7 @@ add_subdirectory(polygon)
add_subdirectory(polygon/kbool/src)
add_subdirectory(potrace)
add_subdirectory(bitmap2component)
#add_subdirectory(new)
#############
# Resources #
......
......@@ -56,10 +56,11 @@ else(DOXYGEN_FOUND)
endif()
include_directories( ${CMAKE_SOURCE_DIR} )
include_directories( ${CMAKE_CURRENT_SOURCE_DIR} )
add_executable( test_dir_lib_source sch_dir_lib_source.cpp )
add_executable( test_dir_lib_source sch_dir_lib_source.cpp ${PROJECT_SOURCE_DIR}/common/richio.cpp )
#add_executable( test_dir_lib_source EXCLUDE_FROM_ALL sch_dir_lib_source.cpp )
target_link_libraries( test_dir_lib_source ${wxWidgets_LIBRARIES} )
#target_link_libraries( test_dir_lib_source common ${wxWidgets_LIBRARIES} )
......@@ -352,21 +352,6 @@ Show architecture here.
*/
typedef std::string STRING;
/**
* Type STRING_TOKS
* documents a container which holds a sequence of s-expressions suitable for parsing
* with DSNLEXER. This can either be a sequence of DSN_SYMBOLs or a sequence of
* fully parenthesis delimited s-expressions. There are 2 types: <ol>
* <li> R C R33 "quoted-name" J2
* <li> (part R ())(part C ())
* </ol>
* Notice that in the 1st example, there are 5 tokens in sequence, and in the
* 2nd example there are two top most s-expressions in sequence. So the counts
* in these are 5 and 2 respectively.
*/
typedef std::dequeue<STRING> STRING_TOKS;
typedef std::dequeue<STRING> STRINGS;
//typedef std::vector<wxString> WSTRINGS;
......
This diff is collapsed.
......@@ -29,6 +29,7 @@
#include <sch_lib.h>
#include <map>
#include <vector>
/**
......@@ -52,10 +53,13 @@ class DIR_LIB_SOURCE : public LIB_SOURCE
{
friend class LIBS; ///< LIBS::GetLib() can construct one.
bool useVersioning; ///< use files with extension ".revNNN..", else not
bool useVersioning; ///< use files with extension ".revNNN..", else not
DIR_CACHE sweets; ///< @todo, don't really need to cache the sweets, only the partnames.
STRINGS categories;
std::vector<char> readBuffer; ///< used by readSExpression()
DIR_CACHE sweets;
STRINGS categories;
/**
* Function isPartFileName
......@@ -75,6 +79,13 @@ class DIR_LIB_SOURCE : public LIB_SOURCE
bool makePartFileName( const char* aEntry,
const STRING& aCategory, STRING* aPartName );
/**
* Function readSExpression
* reads an s-expression into aResult. Candidate for virtual function later.
*/
void readSExpression( STRING* aResult, const STRING& aNameSpec ) throw( IO_ERROR );
/**
* Function doOneDir
* loads part names [and categories] from a directory given by
......@@ -109,39 +120,35 @@ public:
//-----<LIB_SOURCE implementation functions >------------------------------
void ReadPart( STRING* aResult, const STRING& aPartName, const STRING& aRev=StrEmpty )
throw( IO_ERROR )
{
}
throw( IO_ERROR );
void ReadParts( STRING_TOKS* aResults, const STRINGS& aPartNames )
throw( IO_ERROR )
{
}
void ReadParts( STRINGS* aResults, const STRINGS& aPartNames )
throw( IO_ERROR );
void GetCategories( STRING_TOKS* aResults ) throw( IO_ERROR )
{
}
void GetCategories( STRINGS* aResults ) throw( IO_ERROR );
void GetCategoricalPartNames( STRING_TOKS* aResults,
const STRING& aCategory=StrEmpty ) throw( IO_ERROR )
{
}
void GetCategoricalPartNames( STRINGS* aResults, const STRING& aCategory=StrEmpty )
throw( IO_ERROR );
void GetRevisions( STRING_TOKS* aResults, const STRING& aPartName ) throw( IO_ERROR )
void GetRevisions( STRINGS* aResults, const STRING& aPartName ) throw( IO_ERROR )
{
// @todo
}
void FindParts( STRING_TOKS* aResults, const STRING& aQuery ) throw( IO_ERROR )
void FindParts( STRINGS* aResults, const STRING& aQuery ) throw( IO_ERROR )
{
// @todo
}
//-----</LIB_SOURCE implementation functions >------------------------------
#if defined(DEBUG)
/**
* Function Show
* will output a debug dump of contents.
*/
void Show();
#endif
};
} // namespace SCH
......
......@@ -40,7 +40,7 @@
typedef std::string STRING;
typedef std::deque<STRING> STRINGS;
typedef STRINGS STRING_TOKS;
typedef STRINGS STRINGS;
extern const STRING StrEmpty;
......@@ -93,14 +93,14 @@ protected: ///< derived classes must implement
* @param aPartNames is a list of part names, one name per list element.
* @param aResults receives the s-expressions
*/
virtual void ReadParts( STRING_TOKS* aResults, const STRINGS& aPartNames )
virtual void ReadParts( STRINGS* aResults, const STRINGS& aPartNames )
throw( IO_ERROR ) = 0;
/**
* Function GetCategories
* fetches all categories present in the library source into @a aResults
*/
virtual void GetCategories( STRING_TOKS* aResults )
virtual void GetCategories( STRINGS* aResults )
throw( IO_ERROR ) = 0;
/**
......@@ -112,7 +112,7 @@ protected: ///< derived classes must implement
*
* @param aResults is a place to put the fetched result, one category per STRING.
*/
virtual void GetCategoricalPartNames( STRING_TOKS* aResults, const STRING& aCategory=StrEmpty )
virtual void GetCategoricalPartNames( STRINGS* aResults, const STRING& aCategory=StrEmpty )
throw( IO_ERROR ) = 0;
/**
......@@ -120,7 +120,7 @@ protected: ///< derived classes must implement
* fetches all revisions for @a aPartName into @a aResults. Revisions are strings
* like "rev12", "rev279", and are library source agnostic. These
*/
virtual void GetRevisions( STRING_TOKS* aResults, const STRING& aPartName )
virtual void GetRevisions( STRINGS* aResults, const STRING& aPartName )
throw( IO_ERROR ) = 0;
/**
......@@ -139,7 +139,7 @@ protected: ///< derived classes must implement
*
* @param aResults is a place to put the fetched part names, one part per STRING.
*/
virtual void FindParts( STRING_TOKS* aResults, const STRING& aQuery )
virtual void FindParts( STRINGS* aResults, const STRING& aQuery )
throw( IO_ERROR ) = 0;
//-----</abstract for implementors>--------------------------------------
......
# This is a CMake toolchain file for ARM:
# http://vtk.org/Wiki/CMake_Cross_Compiling
# usage
# cmake -DCMAKE_TOOLCHAIN_FILE=../../toolchain-mingw.cmake ..
# It is here to assist Dick with verifying compilation of /new stuff with mingw (under linux)
set( CMAKE_SYSTEM_NAME Linux )
# Specific to Dick's machine, again for testing only:
include_directories( /svn/wxWidgets/include )
#-----<configuration>-----------------------------------------------
# configure only the lines within this <configure> block, typically
# specify the cross compiler
set( CMAKE_C_COMPILER i586-mingw32msvc-gcc )
set( CMAKE_CXX_COMPILER i586-mingw32msvc-g++ )
# where is the target environment
set( CMAKE_FIND_ROOT_PATH /usr/i586-mingw32msvc )
#-----</configuration>-----------------------------------------------
# search for programs in the build host directories
set( CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER )
# for libraries and headers in the target directories
set( CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY )
set( CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY )
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