You can subscribe to this list here.
2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(58) |
Sep
(79) |
Oct
(41) |
Nov
(80) |
Dec
(23) |
---|
From: <sg...@us...> - 2003-09-28 01:35:52
|
Update of /cvsroot/libfunutil/libfunutil/tests/s11n In directory sc8-pr-cvs1:/tmp/cvs-serv3118/tests/s11n Modified Files: FooClass.cpp FooClass.h Makefile test.s11n.cpp Log Message: refinements/improvments to the classloader. Added DLLLoader_boostrap "callback" support, to run boostrapping code when opening an DLL. This allows a way around using S11N_INSTANTIATOR, and a way to dynamically add factories to the classloader from DLLs. Index: FooClass.cpp =================================================================== RCS file: /cvsroot/libfunutil/libfunutil/tests/s11n/FooClass.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- FooClass.cpp 27 Sep 2003 22:36:54 -0000 1.1 +++ FooClass.cpp 28 Sep 2003 01:35:30 -0000 1.2 @@ -1,17 +1,32 @@ + #include <s11n/s11n-macros.h> // COUT/CERR +#include <s11n/s11n_globals.h> // register_serializable_type() // #include <s11n/s11n_globals.h> // trim_string() // #include <s11n/PointerList.h> // #include <s11n/PropertiesProvider.h> -// #include <s11n/ClassLoader.h> -// #include <s11n/Instantiator.h> - +#include <s11n/ClassLoader.h> +#include <s11n/Instantiator.h> +#include <s11n/DLLLoader.h> #include "FooClass.h" + +S11N_INSTANTIATOR(foo,FooClass); + using namespace s11n; using namespace std; -S11N_INSTANTIATOR(FooClass); +extern "C" { + void DLLLoader_bootstrap() + { + typedef s11n::Factory<s11n::Serializable,foo::FooClass> Fac; + COUT << "DLLLoader_bootstrap()" << endl; + s11n::register_serializable_type<foo::FooClass>("WonderBra"); + s11n::register_serializable_type<foo::FooClass>("foo:FooClass"); + } +} + +namespace foo { std::string name; FooClass::FooClass() : Serializable("FooClass") { @@ -32,8 +47,10 @@ bool FooClass::deserialize( const S11nNode & ser ) { + if ( !this->Serializable::deserialize( ser ) ) return false; this->name = ser.get( "name", "<unnamed>" ); return true; } +}; // namespace foo Index: FooClass.h =================================================================== RCS file: /cvsroot/libfunutil/libfunutil/tests/s11n/FooClass.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- FooClass.h 27 Sep 2003 22:36:54 -0000 1.1 +++ FooClass.h 28 Sep 2003 01:35:30 -0000 1.2 @@ -4,6 +4,7 @@ #include <s11n/S11n.h> #include <s11n/S11nIO.h> +namespace foo { struct FooClass:public s11n::Serializable { std::string name; @@ -13,5 +14,5 @@ virtual bool deserialize( const s11n::S11nNode & ser ); }; - +}; // namespace foo #endif // FOO_H_INCLUDED Index: Makefile =================================================================== RCS file: /cvsroot/libfunutil/libfunutil/tests/s11n/Makefile,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- Makefile 27 Sep 2003 22:36:54 -0000 1.1 +++ Makefile 28 Sep 2003 01:35:30 -0000 1.2 @@ -12,21 +12,22 @@ ifeq (1,$(configure_have_zlib)) BIN_PROGRAMS_LDADD += -lz $(L_S11N) -ldl -export-dynamic endif -sertest_bin_OBJECTS = test.s11n.o BarClass.o +sertest_bin_OBJECTS = test.s11n.o sertest_bin_LDADD += $(LQT) $(top_srcdir)/lib/funUtil/libfunUtil.a dlopen_bin_OBJECTS = dlopen.o -SHARED_LIBS = FooClass BarClass +SHARED_LIBS = FooClass BarClass BigSO SHARED_LIBS_LDADD = $(L_S11N) FooClass_so_OBJECTS = FooClass.o -FooClass_so_VERSION = 0.9.9 BarClass_so_OBJECTS = BarClass.o +BigSO_so_OBJECTS = BarClass.o FooClass.o include $(toc_makesdir)/cpp_dynamic_libs.make include $(toc_makesdir)/cpp_bins.make CLEAN_FILES += $(wildcard *.o) + all: libs-shared $(BIN_PROGRAMS) Index: test.s11n.cpp =================================================================== RCS file: /cvsroot/libfunutil/libfunutil/tests/s11n/test.s11n.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- test.s11n.cpp 27 Sep 2003 22:36:54 -0000 1.1 +++ test.s11n.cpp 28 Sep 2003 01:35:30 -0000 1.2 @@ -33,8 +33,6 @@ // #include "BarClass.h" - - namespace fake { struct FakeRoot:public Serializable @@ -45,15 +43,9 @@ typedef PointerList < s11n::Serializable > FakeVec; //typedef std::vector<BarClass *> FakeVec; FakeVec m_vec; - FakeRoot( ) + FakeRoot( ) : Serializable( "fake::FakeRoot" ) { - //LOUT << "FakeRoot()" << endl; - this->implClass( "fake::FakeRoot" ); m_vec.autoDelete( true ); -// m_vec.push_back( new BarClass( ) ); -// m_vec.push_back( new BarClass( ) ); -// m_vec.push_back( new BarClass( ) ); -// ( *m_vec.begin( ) )->name = "google"; }; virtual ~ FakeRoot( ) { @@ -61,8 +53,7 @@ virtual bool serialize( S11nNode & node ) const { - if ( !this->Serializable::serialize( node ) ) - return false; + if ( !this->Serializable::serialize( node ) ) return false; node.set( "foo", m_foo ); node.set( "bar", m_bar ); node.serializeChildren( "foo_child", m_vec ); @@ -74,8 +65,7 @@ //m_vec.deleteAll(); m_foo = ser.get( "foo", "<not set>" ); m_bar = ser.get( "bar", "<not set>" ); - //ser.childrenCast( "foo_childs", m_vec ); - m_vec.deleteAll( ); + m_vec.deleteAll(); ser.deserializeChildren( "foo_child", m_vec ); COUT << "deser: foo_child count: " << m_vec.size( ) << std::endl; COUT << "deser: m_foo=["<<m_foo<<"]"<<std::endl; @@ -88,31 +78,6 @@ }; // namespace fake -// #include "FooClass.h" -void -register_initial_node_classes( ) -{ - typedef Instantiator < Serializable > SerFactory; - typedef ClassLoader < Serializable > SerLoader; - -// s11n::register_serializable_type<FooClass>( "FooClass" ); - - SerLoader::registerFactory( "fake::FakeRoot", Factory < Serializable, fake::FakeRoot >::newInstance ); - -// typedef Factory < Serializable, BarClass > BarInst; -// SerLoader::registerFactory( "woo::hoo::BarClass", BarInst::newInstance ); -// SerLoader::registerFactory( "bar::BarClass", BarInst::newInstance ); -// SerLoader::registerFactory( "BarClass", BarInst::newInstance ); - //SerLoader::registerFactory( "FooClass", BarInst::newInstance ); - -// #define CLREG(clN) SerLoader::registerFactory( # clN, SerFactory::newInstance ); -// CLREG(GEVHex); -// CLREG(fun::HexMap); -// CLREG(fun::HexNumberStyle); -// CLREG(fun::MapAreaTerrainFeature); - -} - // void // testtree( ) @@ -139,6 +104,29 @@ // delete( cleanbar ); // } + +extern "C" { + /** + Called by DLLLoader the first time it tries to load a + class from the global space. + */ + void DLLLoader_bootstrap() + { + COUT << "DLLLoader_bootstrap()" << endl; + s11n::register_serializable_type<fake::FakeRoot>( "fake::FakeRoot" ); + +#define CLREG(clN) COUT << "Warning: faking class type for " << # clN << std::endl; \ +s11n::register_serializable_type<s11n::Serializable>( # clN ); + + CLREG(GEVHex); + CLREG(fun::HexMap); + CLREG(fun::HexNumberStyle); + CLREG(fun::MapAreaTerrainFeature); + + } +} + + int main( int argc, char **argv ) { @@ -161,8 +149,7 @@ COUT << "You must specify an input file with -f or --file." << endl; return 1; } - - register_initial_node_classes( ); + //register_initial_node_classes( ); std::ostream * os = &std::cout; string ofilename = args.getString( "-o", "" ).data( ); |
From: <sg...@us...> - 2003-09-27 22:40:54
|
Update of /cvsroot/libfunutil/libfunutil In directory sc8-pr-cvs1:/tmp/cvs-serv8685 Modified Files: configure.libfunutil toc_shared.make.at Log Message: toc modernization and s11n-related changes. Index: configure.libfunutil =================================================================== RCS file: /cvsroot/libfunutil/libfunutil/configure.libfunutil,v retrieving revision 1.18 retrieving revision 1.19 diff -u -d -r1.18 -r1.19 --- configure.libfunutil 31 Aug 2003 00:50:26 -0000 1.18 +++ configure.libfunutil 27 Sep 2003 22:40:40 -0000 1.19 @@ -1,7 +1,6 @@ # package-specific configure script for libfunutil -toc_run_fail toc_tests_help -toc_run_failok buildtool +# toc_run_failok buildtool toc_add_config PACKAGE_COPYRIGHT="GNU General Public License, version 2. Copyright (c) 2000-2003 Rusty Ballinger (bo...@so...) and stephan beal (sg...@us...)." @@ -11,9 +10,9 @@ LDFLAGS="$LDFLAGS -L\$(top_srcdir)/lib/fun" -toc_run_fail gnu_cpp_tools "C/C++ compilers and linkers" -toc_run_failok readline "got readline library?" - +toc_run_fail gnu_cpp_tools +toc_run_failok readline +toc_run_failok zlib toc_add_config_h PACKAGE_EMAIL_ADDRESS=lib...@li... PACKAGE_URL=http://libfunutil.sourceforge.net/ @@ -26,13 +25,11 @@ toc_add_make configure_enable_cppdeps=1 -toc_run_failok doxygen "Enable API doc generation?" +toc_run_failok doxygen configure_with_qt=${configure_with_qt-1} -qt_required_version='3.x' -qt_required_version_glob='3.*' -toc_run_fail qt_if_enabled +toc_run_fail qt_if_enabled '3.x' '3.*' # If we're building with Qt, see whether we're also building std::string API's if test "${configure_with_qt}" = "1"; then @@ -60,6 +57,9 @@ source ${configure_developer_script} || toc_die $? "${configure_developer_script} failed" } +test x1 = "x${configure_enable_s11n}" && { + toc_run_fail flex +} echo ============================================================== echo "${PACKAGE_NAME} configuration checks completed." Index: toc_shared.make.at =================================================================== RCS file: /cvsroot/libfunutil/libfunutil/toc_shared.make.at,v retrieving revision 1.22 retrieving revision 1.23 diff -u -d -r1.22 -r1.23 --- toc_shared.make.at 31 Aug 2003 20:33:30 -0000 1.22 +++ toc_shared.make.at 27 Sep 2003 22:40:40 -0000 1.23 @@ -119,8 +119,9 @@ - - +configure_have_zlib = @HAVE_ZLIB@ +configure_enable_s11n = @configure_enable_s11n@ +configure_build_quietly = @configure_build_quietly@ configure_with_libreadline = @configure_with_libreadline@ ifeq ($(configure_with_libreadline),1) |
From: <sg...@us...> - 2003-09-27 22:40:24
|
Update of /cvsroot/libfunutil/libfunutil/tests In directory sc8-pr-cvs1:/tmp/cvs-serv8610/tests Modified Files: Makefile Log Message: added s11n subdir. Index: Makefile =================================================================== RCS file: /cvsroot/libfunutil/libfunutil/tests/Makefile,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- Makefile 10 Aug 2003 14:49:54 -0000 1.2 +++ Makefile 27 Sep 2003 22:40:15 -0000 1.3 @@ -1,4 +1,8 @@ SUBDIRS = funUtil include toc.make -all: $(SUBDIRS) +ifeq (1,$(configure_enable_s11n)) +SUBDIRS += s11n +endif + +all: subdirs |
From: <sg...@us...> - 2003-09-27 22:40:16
|
Update of /cvsroot/libfunutil/libfunutil/lib In directory sc8-pr-cvs1:/tmp/cvs-serv8510/lib Modified Files: Makefile Log Message: added s11n subdir. Index: Makefile =================================================================== RCS file: /cvsroot/libfunutil/libfunutil/lib/Makefile,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- Makefile 29 Aug 2003 05:38:43 -0000 1.3 +++ Makefile 27 Sep 2003 22:40:02 -0000 1.4 @@ -1,7 +1,11 @@ +include toc.make + SUBDIRS = funUtil -include toc.make +ifeq (1,$(configure_enable_s11n)) +SUBDIRS += s11n +endif all: subdirs |
From: <sg...@us...> - 2003-09-27 22:39:57
|
Update of /cvsroot/libfunutil/libfunutil/include In directory sc8-pr-cvs1:/tmp/cvs-serv8464/include Modified Files: Makefile Log Message: added s11n subdir. Index: Makefile =================================================================== RCS file: /cvsroot/libfunutil/libfunutil/include/Makefile,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- Makefile 23 Aug 2003 00:35:59 -0000 1.4 +++ Makefile 27 Sep 2003 22:39:43 -0000 1.5 @@ -2,6 +2,10 @@ SUBDIRS = fun include toc.make +ifeq (1,$(configure_enable_s11n)) +SUBDIRS += s11n +endif + DIST_FILES += config.h.at DISTCLEAN_FILES += config.h |
From: <sg...@us...> - 2003-09-27 22:38:43
|
Update of /cvsroot/libfunutil/libfunutil/include In directory sc8-pr-cvs1:/tmp/cvs-serv8291/include Modified Files: config.h.at Log Message: added HAVE_ZLIB Index: config.h.at =================================================================== RCS file: /cvsroot/libfunutil/libfunutil/include/config.h.at,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- config.h.at 30 Aug 2003 19:44:19 -0000 1.5 +++ config.h.at 27 Sep 2003 22:38:25 -0000 1.6 @@ -18,10 +18,14 @@ #define BUILD_DESCRIPTION "@PACKAGE_NAME@ @PACKAGE_VERSION@ built " __TIME__ " " __DATE__ " by @BUILD_USER@@@BUILD_HOST@" #define HAVE_READLINE @HAVE_READLINE@ -// ^^^^ comment-out or define it to 0 if you do not run the 'readline' test. +// ^^^^ from the readline test #define CONFIG_HAVE_QT @HAVE_QT@ +// ^^^^ from the qt test #define CONFIG_HAVE_CYGWIN @CYGWIN@ // toc test: running_under_cygwin. 0 or 1 +// ^^^^ from the running_under_cygwin test +#define HAVE_ZLIB @HAVE_ZLIB@ +// ^^^^ from the zlib test #endif // CONFIG_H_INCLUDED |
From: <sg...@us...> - 2003-09-27 22:37:52
|
Update of /cvsroot/libfunutil/libfunutil/lib/s11n/parsers In directory sc8-pr-cvs1:/tmp/cvs-serv8145/lib/s11n/parsers Added Files: .indent.pro Makefile common_flex_definitions.in flex_lexers.cpp flex_lexers.h funtxt.flex.at funxml.flex.at select_lexer.flex.at simplexml.flex.at Log Message: egg --- NEW FILE: .indent.pro --- -i8 -bl -bli0 -sob0 --use-tabs --line-length 200 --no-space-after-function-call-names --space-after-parentheses //--no-space-after-parentheses // --blank-lines-after-declarations --dont-break-function-decl-args --dont-break-function-decl-args-end //--dont-break-procedure-type --no-parameter-indentation --leave-optional-blank-lines --- NEW FILE: Makefile --- include toc.make SOURCES = \ flex_lexers.cpp HEADERS = \ flex_lexers.h INSTALL_PACKAGE_HEADERS = $(HEADERS) FLEXES = funtxt funxml select_lexer simplexml SOURCES_FLEX = $(addsuffix .flex.cpp,$(FLEXES)) FLEXES_ARGS = -p -+ funtxt_FLEXES_ARGS = -B -Psertxt funxml_FLEXES_ARGS = -B -Pserxml cli_FLEXES_ARGS = -B -Pcli select_lexer_FLEXES_ARGS = -B -Pselect_lexer simplexml_FLEXES_ARGS = -B -Psimplexml include $(toc_makesdir)/flex.make COMMON_FLEX_DEFS = common_flex_definitions.in flex_definitions = include:COMMON_DEFINITIONS=$(COMMON_FLEX_DEFS) funtxt.flex: funtxt.flex.at $(COMMON_FLEX_DEFS) Makefile @$(call toc_atparse_file,$<,$@, \ $(flex_definitions) \ ) || exit; touch $@ funxml.flex: funxml.flex.at $(COMMON_FLEX_DEFS) Makefile @$(call toc_atparse_file,$<,$@, \ $(flex_definitions) \ ) || exit; touch $@ select_lexer.flex: select_lexer.flex.at $(COMMON_FLEX_DEFS) Makefile @$(call toc_atparse_file,$<,$@, \ $(flex_definitions) \ ) || exit; touch $@ simplexml.flex: simplexml.flex.at $(COMMON_FLEX_DEFS) Makefile @$(call toc_atparse_file,$<,$@, \ $(flex_definitions) \ ) || exit; touch $@ %.flex: Makefile OBJECTS = $(patsubst %.cpp,%.o,$(SOURCES) $(SOURCES_FLEX)) INSTALL_PACKAGE_HEADERS = $(HEADERS) # DIST_FILES += $(sort $(wildcard *.cpp) $(wildcard *.h) $(wildcard *.make)) DIST_FILES += $(SOURCES) $(HEADERS) \ $(addsuffix .flex.at,$(FLEXES)) $(COMMON_FLEX_DEFS) strip: $(THISLIB_STATIC) $(THISLIB_SHARED) $@ $(THISLIB_STATIC) $(THISLIB_SHARED) SYMLINK_HEADERS = $(INSTALL_PACKAGE_HEADERS) SYMLINK_HEADERS_DEST = $(top_srcdir)/include/s11n include $(toc_makesdir)/symlink_headers.make all: symlink-headers $(OBJECTS) select_lexer_bin_SOURCES = select_lexer.flex.cpp select_lexer_bin_CFLAGS = $(INCLUDES) -DSELECT_LEXER_DO_MAIN=1 -g select_lexer_bin_OBJECTS = $(OBJECTS) select_lexer_bin_LFLAGS = -lstdc++ $(LIBREADLINE_LDADD) select_lexer: select_lexer.flex all Makefile $(call toc_compile_c_binary,select_lexer) simplexml_bin_SOURCES = simplexml.flex.cpp simplexml_bin_CFLAGS = $(INCLUDES) -DSIMPLEXML_DO_MAIN=1 -g simplexml_bin_OBJECTS = $(OBJECTS) simplexml_bin_LFLAGS = -lstdc++ $(LIBREADLINE_LDADD) simplexml: simplexml.flex all Makefile $(call toc_compile_c_binary,simplexml) DIST_FILES += $(SOURCES) $(HEADERS) \ $(addsuffix .flex.at,$(FLEXES)) $(COMMON_FLEX_DEFS) CLEAN_FILES += *.o --- NEW FILE: common_flex_definitions.in --- SPACE [ \t] NONSPACE [^ \t] WORD [_[:alnum:]]+ WORDS (({WORD}{SPACE}){2,}) START_OF_LINE ^({SPACE}*) DIGIT [0-9] INTEGER ({DIGIT}+) DOUBLE_QUOTED_STRING ([\"]([^\"]|(\\\"))+[\"]) SINGLE_QUOTED_STRING ([\'][^\']*[\']) QUOTED_STRING ({SINGLE_QUOTED_STRING}|{DOUBLE_QUOTED_STRING}) // QUOTED_STRING: doesn't yet handle escaped quotes-in-quotes. Need to use //# separate states for that, i think. NUMBER_type1 [-+]?{DIGIT}+\.?([eE][-+]?{DIGIT}+)? NUMBER_type2 [-+]?{DIGIT}*\.{DIGIT}+([eE][-+]?{DIGIT}+)? NUMBER ({NUMBER_type1}|{NUMBER_type2}) CLASSNAME (({WORD}\:\:)+)?{WORD} ALMOST_A_WORD [\._a-zA-Z0-9]+ VARNAME_LENIENT ([a-zA-Z_][\.\-_a-zA-Z0-9]*|{CLASSNAME}) HEX_DIGIT ([a-fA-F0-9]) RGB_COLOR (#{HEX_DIGIT}{6}) SEMICOLON ({SPACE}*;+{SPACE}*) // ESCAPED_MULTILINE ((.*\$)/[^(\\\n)]*) // ESCAPED_MULTILINE ([.]+([^\\]\n$)) // {ESCAPED_MULTILINE}| // PROPERTY_TYPES ({ESCAPED_MULTILINE}) //UNTIL_SEMICOLON .+\;{SPACE}*$ //PROPERTY_VALUE ({NUMBER}|{ALMOST_A_WORD}|{QUOTED_STRING}|{WORD_WITH_PUNCTUATION}|{RGB_COLOR}) // WORD_WITH_PUNCTUATION [#.\!\?\-_a-zA-Z0-9]+ //UNTIL_EOL ([.\n]+[^\\]$) UNTIL_SEMICOLON (.+;) //ESCAPED_LINES ((.+([\\]\n))+[^\\]\n) PROPERTY_DECL_RULES ({QUOTED_STRING}|{ALMOST_A_WORD}|{WORDS}|{RGB_COLOR}) PROP_DECL_EQUALS ({WORD}{SPACE}*={SPACE}*) PROP_DECL_SPACE ({WORD}{SPACE}+) PROPERTY_DECLS ({PROP_DECL_EQUALS}|{PROP_DECL_SPACE}) PROPERTY_DEFINITION ({PROPERTY_DECLS}{PROPERTY_DECL_RULES}) // \<[^/][^\>]+\> { add_token( elib::efstring( "opening ",YYText() ) ); } // \<\/[^\>]+\> { add_token( elib::efstring( "closing ",YYText() ) ); } --- NEW FILE: flex_lexers.cpp --- /** Author: stephan beal <sg...@us...> License: Public Domain */ #include "flex_lexers.h" #include <cassert> #include <s11n/s11n-macros.h> // COUT /** stubs for dupe code from the lexers... */ namespace s11n { FlexTreeBuilder::FlexTreeBuilder( ):m_lexer( 0 ), m_lexer_inited( false ), m_builder( 0 ) { } FlexTreeBuilder::~FlexTreeBuilder( ) { this->cleanup( ); } FlexLexer *FlexTreeBuilder::lexer( ) { //COUT << "lexer() @ " << std::hex<< m_lexer<< ""<<std::endl; return this->m_lexer; } void FlexTreeBuilder::lexer( FlexLexer * newlexer ) { delete( this->m_lexer ); this->m_lexer = newlexer; } s11n::S11nNode * FlexTreeBuilder::root_node( ) { if ( !this->m_builder ) return NULL; return this->m_builder->root_node( ); } int FlexTreeBuilder::lexer_loop( ) { FlexLexer *l = this->lexer( ); int ret; //COUT << "lexer_loop()"; while ( 0 != ( ret = l->yylex( ) ) ) { //std::cout << (char) ret; } //std::cout << std::endl; return ret; } void FlexTreeBuilder::reset( ) { if ( m_builder ) delete( m_builder ); m_builder = new s11n::S11nNodeBuilder( ); m_lexer_inited = true; } void FlexTreeBuilder::cleanup( ) { delete( m_builder ); m_builder = 0; m_lexer_inited = false; delete( this->m_lexer ); this->m_lexer = 0; } s11n::S11nNodeBuilder * FlexTreeBuilder::builder( ) { if ( !m_lexer_inited ) this->reset( ); return m_builder; } bool FlexTreeBuilder::load( std::istream & in ) { // UNTESTED if ( !in ) return false; FlexLexer *fl = this->lexer( ); fl->switch_streams( &in ); int ret; //COUT << "load( istream & )... "; ret = this->lexer_loop( ); //COUT << "done." << endl; //COUT << "ret="<<ret<<endl; if ( 0 != ret ) { this->reset( ); } return ( 0 == ret ); } } // namespace s11n --- NEW FILE: flex_lexers.h --- /** Author: stephan beal <sg...@us...> License: Public Domain */ #ifndef FLEX_FUNTXT_H_INCLUDED #define FLEX_FUNTXT_H_INCLUDED 1 #include <string> #include <iostream> #ifndef FLEX_SCANNER #include <FlexLexer.h> #endif #include <s11n/S11n.h> #include <s11n/S11nNodeBuilder.h> #define LEXER_LOUD 1 #if LEXER_LOUD # include <s11n/s11n-macros.h> // COUT/CERR #endif #define LOUT if(LEXER_LOUD) CERR #define lout if(LEXER_LOUD) cerr namespace s11n { /** FlexTreeBuilder declares an EXPERIMENTAL quasi-interface into the libfun/s11n-related flex parsers. It is meant to be included by the parsers and their clients. The ground rules are described in the FlexTreeBuilder struct, but the same notes apply to all the lexers which subclass it. (Why all this hassle? Because getting multiple flex-based parsers into one library is more painful than it really ought to be, and the FlexLexer subclasses must be well-hidden from clients to avoid potential compilation problems.) Much of this code is implemented in flex_lexers.cpp, but some of it must be implemented by the specific lexers and lives elsewhere. Big Fat Warning: This interface is COMPLETELY not thread-safe! Much of the internal data used by the lexers is global-scope and multiple lexers, even of different types, should NOT be used in parallel! This can be considered a bug, and this limitation may be addressed (i.e., put off again) at some point. Usage notes: - You must never delete any lexer you fetch via lexer(). - You should call FlexTreeBuilder::cleanup() when you're done so the tree builder can be deleted. Deleting a builder will clean it up, obviously. If you need to hold on to it's output you can call builder()->autoDelete(false) to keep it from deleting the parsed-in node(s). - As in XML, subclasses should assume that each input block contains exactly one root node, and stop parsing after processing one node. (This is purely a point of long-standing conventions.) Developer notes: - see the samples in {cli,fun{txt,xml}}.flex.at. todo: investigate making this a subclass of S11nNodeBuilder. */ class FlexTreeBuilder { // implementation lives in flex_lexers.cpp public: virtual ~ FlexTreeBuilder( ); /** FlexLexer * lexer() Returns the FlexLexer parser set via lexer( FlexLexer * ), which subclasses should call to set the proper lexer. The default behaviour is to return NULL. This object is absolutely useless until the lexer() is set. The caller DOES NOT own the returned pointer. lexer implementors: you may want to do any one-time initialization of your lexer in the first call to lexer(). This is the only function which provides public access to your lexer, so doing any initialization here will ensure that it gets called before the lexer is actually used. Typically a call to reset() should be done here, as that creates a new internal tree builder (see builder(), below). By convention (the one set by FunXML and FunTxt, that is), a lexer should generally stop lexing after reading one DOM node. This assumes that, as in XML, there is one root node in any input. This model appears to work well for a wide variety of cases (the majority, i would say), so please don't let this minor limitation bother you (if it makes it any better, it's really up to the lexer what defines "a root node", and it could even artificially wrap it's output in an artificial root if it needed to). That said, the S11nNodeBuilder interface /should/ work with multiple root nodes, but it has only vaguely been tested. After a lexer()->yylex() loop, if parsing got a root node it will be available via root_node(). */ virtual FlexLexer *lexer( ); /** This function is simply a shortcut for builder()->root_node(). The default condition is that the caller does not own the returned pointer. The caller owns the given pointer if this->builder()->autoDelete() returns false, otherwise the pointer will be deleted when this object is cleaned up (via cleanup() or deletion). Typically clients should call this after a lexer().yylex() loop to fetch the object the parser collected. */ s11n::S11nNode * root_node( ); /** Returns the current dom builder, which gets (or should get) populated by this object's lexer(). You can get much more info about the tree via this object, but it is rarely necessary to do so. The caller does not own the returned pointer. */ s11n::S11nNodeBuilder * builder( ); /** Resets the parser to use a new builder. This deletes the object returned by builder(), so be careful not to hang on to that pointer too long. It is intended to be used by subclasses but may have uses in other contexts. */ virtual void reset( ); /** Should be called after you are done lexing and retrieving the nodes so the lexer can free the builder (which also frees any loaded nodes). */ virtual void cleanup( ); /** Convenience function: does a while(lexer()->yylex() != 0) loop and returns the last code returned by yylex(). If parsing gets a root node it will be available via root_node() or via the builder() object. */ int lexer_loop( ); /** convenience function: parses the given input stream and stops parsing when this->lexer() is done with it. This normally means it stops after matching one input node. Note that the "one node rule" is conventional only: subclasses may choose to parse more than one node out of the input stream before returning. s11n convention, however, is to assume that any loaded data is contained in one root node. If the load fails then it is still possible that the builder() has some content, but it may be in an undefined state. */ bool load( std::istream & in ); /** Subclasses need to call this, passing their proper lexer type. It will delete any previously-assigned object. It may be useful for non-subclasses to call this, but it certainly only for unusual or particularly complex. */ void lexer( FlexLexer * lexer ); /** loadBuilder() looks at the first line of the given file and tries to select an appropriate lexer for the token. It returns a pointer, perhaps NULL, which the caller takes responsibility for. If it finds a lexer but it finds no parseable tokens it will return NULL. If it finds a lexer it passes the file stream to the lexer, which will then populate the new builder object. If that fails then the builder is deleted and NULL is returned. Developer notes: This function WOULD take an istream, but i can't(?) reliably(?) read from it twice (once to get the magic cookie and once to feed the whole thingto the parser). Reading JUST the cookie, then passing the stream on to a different lexer for parsing screws up the stream (i'm theorizing that it's a side-effect of FlexLexer::switch_streams()'s deletion behaviour, but haven't investigated it fully). This function is implemented in select_lexer.flex.at. */ static FlexTreeBuilder *loadBuilder( const std::string & filename ); protected: /** Only subclasses may instantiate objects of this class. */ FlexTreeBuilder( ); private: FlexLexer * m_lexer; bool m_lexer_inited; s11n::S11nNodeBuilder * m_builder; }; /** FunXML is for parsing what's known variably as "text", "serial-text" and "Rusty's" format. It's a simple-grammared text-based DOM which is easy for humans to read and hand-edit, as well as fairly easy to parse. This format is used by the QUB project (qub.sourceforge.net) and libFunUtil (libfunutil.sourceforge.net). */ class FunTxt:public FlexTreeBuilder { // implementation lives in FunTxt.flex.at public: FunTxt( ) { }; virtual ~ FunTxt( ) { }; virtual FlexLexer *lexer( ); virtual void reset( ); }; /** FunXML is for parsing what's sometimes affectionately known as "fun-xml format", which is a very limited dialect of XML used extensively by the QUB project (qub.sourceforge.net) and libFunUtil (libfunutil.sourceforge.net). Known "Potential Problems": - does not yet properly translate any characters, like > and <. i.e., it doesn't translate at all. */ class FunXML:public FlexTreeBuilder { // implementation lives in FunXML.flex.at public: FunXML( ) { }; virtual ~ FunXML( ) { }; virtual FlexLexer *lexer( ); virtual void reset( ); }; /** This flexer parses a more complete dialect of XML than FunXML. Because S11nNode uses key=val properties to store all aribtrary data, and does not directly support the notion of CDATA, this class does some special handling of the "CDATA" property in deserialized nodes, and the SerializerSimpleXML does the appropriate fiddling on the other end. i don't want to add a cdata-style type to the lower-level interface because it would only be there to accomodate XML, yet clients should not need to know they are working with XML. That said, however, XML-specific clients which use this class need to be aware that the CDATA is stored in the CDATA property of S11nNodes which are deserialized by this class (e.g., available via node.getString("CDATA")). */ class SimpleXMLFlexer:public FlexTreeBuilder { // implementation lives in simplexml.flex.at public: SimpleXMLFlexer( ) { }; virtual ~ SimpleXMLFlexer( ) { }; virtual FlexLexer *lexer( ); virtual void reset( ); }; }; // namespace s11n #endif // FLEX_FUNTXT_H_INCLUDED --- NEW FILE: funtxt.flex.at --- %option c++ %{ /** @LICENSE */ /** my first lex :) This code is for parsing Rusty Ballinger's "text mode serialization format" (as we call it). Here's a rough spec: nodename class=ClassName { property1_name property1_value property2_name "value with spaces" propertyN_name 'or single quotes' foo this \ line is split \ with backslashes. # comment lines nodename class=SomeClass { ... } } Extensions to the original format, probably not tolerated by older code and should probably be left out: - properties can be declared with an optional '=' between the key and value, if that makes you feel better. - Trailing semicolons are optional after '}' and properties. - comment lines can now start with ; or # or // - C++-style comment blocks are supported. See node_functions.h for the callbacks which this parser expects to send output to. Known problems: - If node_depth() is non-zero when this code starts parsing then it does not work properly at all. */ #define YY_SKIP_YYWRAP 1 int yywrap() { return 1; } // #include <stdio.h> #include <cassert> #include <iostream> #include <string> #include <deque> #include <s11n/s11n-macros.h> // COUT/CERR #include <s11n/s11n_globals.h> // trim_string() #include <s11n/PropertiesProvider.h> #include <s11n/ClassLoader.h> #include <s11n/Instantiator.h> #include <s11n/KeyValueParser.h> #include <s11n/S11n.h> // S11nNode and friends. #include <s11n/S11nNodeBuilder.h> #include <s11n/flex_lexers.h> using std::cin; using std::cerr; using std::cout; using std::endl; /** big todos: - use proper lex STATES instead of assert_depth, if feasible. - add syntax extension: nodename class=SomeClass N where N is a number. That is, the node is replicated N times into the output. - add syntax extension: # nodename class=Foo will comment out the whole class block. */ namespace FunTxti { unsigned long ignored; unsigned long bracedepth; s11n::S11nNodeBuilder * serbuilder; std::string nodename; std::string nodeclass; static s11n::KeyValueParser kvp; bool parseKVP( const std::string & str ) { std::string val = str; s11n::trim_string( val ); std::string delim = " "; if( val.find( "=" ) != val.npos /* < val.find( " " ) */ ) delim = "="; //LOUT << "parseKVP:=["<<val<<"] delim='"<<delim<<"'"<<endl; if( ! kvp.parse( val, delim ) ) return false; val = kvp.value(); s11n::normalize_string( val ); if( ';' == val[val.size()-1] ) val.resize( val.size()-1 ); //LOUT << "stripped value=["<<val<<"] from ["<<kvp.value()<<"]"<<endl; kvp.value( val ); return true; } }; // FunTxt_internal FunTxti; #define assert_depth if( FunTxti::bracedepth != FunTxti::serbuilder->node_depth() ) { ++FunTxti::ignored; return 1; } namespace s11n { FlexLexer * FunTxt::lexer() { FlexLexer * fp = 0; fp = this->FlexTreeBuilder::lexer(); if( fp ) return fp; // else first-time setup: this->reset(); return this->FlexTreeBuilder::lexer(); } void FunTxt::reset() { this->FlexTreeBuilder::reset(); //this->lexer( new sertxtFlexLexer() ); // gcc 3.3 bitches about this.no matching function for call to `FunTxt::lexer(FlexLexer*&)' FlexLexer * foo = new sertxtFlexLexer(); this->FlexTreeBuilder::lexer( foo ); FunTxti::serbuilder = this->builder(); FunTxti::ignored = 0; FunTxti::bracedepth = 0; } } // namespace s11n %} @COMMON_DEFINITIONS@ // COMMON_DEFINITIONS: See common_flex_definitions.in %% "/*""*"* { // there is apparently an endless loop caused in some cases with this :/ // c++-style comments. Code mostly taken from the flex info pages. ++FunTxti::ignored; int c; while((c = yyinput()) != 0) { if(c == '*') { c = yyinput(); if( 0 == c || '/' == c ) break; //??? else unput(c); } //lout << (char)c; } //lout << "\n"; return 1; } ({SPACE}*)([;#]|\/).* { ++FunTxti::ignored; return 1; /* single-line comment */ } ({SPACE}*){WORD}{SPACE}+{WORD}={CLASSNAME} { // FunTxti::nodename class=foo::Bar std::string foo = YYText(); s11n::trim_string( foo ); //LOUT << "class dec token=["<<foo<<"]"<<endl; FunTxti::nodename = foo.substr( 0, foo.find_first_of( " \t" ) ); FunTxti::nodeclass = foo.substr( foo.find( "=" ) + 1 ); int ret = FunTxti::serbuilder->open_node( FunTxti::nodeclass, FunTxti::nodename ) ? 1 : -1; if( (ret == -1) ) { // LOUT << "lexer: fail option is enabled, so i'm failing on the first failed open_node(). error token is:" << endl; LOUT << foo << endl; return 0; } //LOUT << FunTxti::bracedepth << " opening class node " << FunTxti::nodeclass << " : " << FunTxti::nodename << std::endl; return ret; } \{ { // node's opening brace ++FunTxti::bracedepth; // nothing. return 1; } \}({SEMICOLON})? { // node's closing brace if( FunTxti::bracedepth == FunTxti::serbuilder->node_depth() ) { // avoid closing node when open_node() fails //LOUT << FunTxti::bracedepth-1<<" closing node"<<std::endl; FunTxti::serbuilder->close_node(); } --FunTxti::bracedepth; if( 0 == FunTxti::serbuilder->node_depth() ) { // return once we close the first top-level node. //if( FunTxti::ignored ) LOUT << "lexer ignored " << FunTxti::ignored << " token"<<(FunTxti::ignored!=1?"s":"") << endl; return 0; } //LOUT << "node depth="<<FunTxti::serbuilder->node_depth()<<" brace_depth="<<FunTxti::bracedepth<<std::endl; //return 0; } {PROPERTY_DECLS} { // property_name [=]? value assert_depth; std::string foo = YYText(); //LOUT << "property decl: " << foo << endl; int c1, c2; c2 = 0; while((c1 = yyinput()) != 0) { // grab \-escaped newlines //lout << (char)c1; if( (c1 != '\n') || ('\n' == c1 && '\\' == c2) ) { foo += c1; c2 = c1; } else break; } //lout << endl; //LOUT << "property token=["<<foo<<"]"<<endl; if( FunTxti::parseKVP( foo ) ) { FunTxti::serbuilder->add_property( FunTxti::kvp.key(), FunTxti::kvp.value() ); return 1; } LOUT << "failed parsing key/value pair from property token ["<<foo<<"]"<<endl; return -1; } .|\n|{SPACE}+ {;} %% --- NEW FILE: funxml.flex.at --- %option c++ %{ /** @LICENSE */ /** */ #define YY_SKIP_YYWRAP 1 int yywrap() { return 1; } #include <cassert> #include <iostream> #include <string> // #include <s11n/s11n-macros.h> // COUT/CERR #include <s11n/flex_lexers.h> using std::cin; using std::cerr; using std::cout; using std::endl; class FunXML_internal { public: unsigned long bracedepth; std::string nodename; std::string nodeclass; std::string yystr; std::string cdata; s11n::S11nNodeBuilder * builder; }; // struct FunXML_internal FunXML_internal FunXMLi; namespace s11n { FlexLexer * FunXML::lexer() { FlexLexer * fp = 0; fp = this->FlexTreeBuilder::lexer(); if( fp ) return fp; // else first-time setup: this->reset(); return this->FlexTreeBuilder::lexer(); } void FunXML::reset() { this->FlexTreeBuilder::reset(); FunXMLi.bracedepth = 0; this->FlexTreeBuilder::lexer(new serxmlFlexLexer()); FunXMLi.builder = this->builder(); } } // namespace s11n %} @COMMON_DEFINITIONS@ // COMMON_DEFINITIONS: See common_flex_definitions.in %% \<{WORD}{SPACE}+"class=\""{CLASSNAME}"\""{SPACE}*\> { // opening a node ++FunXMLi.bracedepth; FunXMLi.yystr = YYText(); //COUT << "class node? "<<FunXMLi.yystr<<std::endl; std::string::size_type opos = FunXMLi.yystr.find( "class=\"" ) + 7; std::string::size_type cpos = FunXMLi.yystr.find( "\"", opos ); FunXMLi.nodeclass = FunXMLi.yystr.substr( opos, cpos - opos ); FunXMLi.nodename = FunXMLi.yystr.substr( 1, FunXMLi.yystr.find_first_of( " \t\n" ) - 1 ); FunXMLi.builder->open_node(FunXMLi.nodeclass, FunXMLi.nodename); continue; } \<[^/]{WORD}\> { // opening a property FunXMLi.cdata = ""; ++FunXMLi.bracedepth; } \<\/{WORD}\> { // closing something FunXMLi.yystr = YYText(); if( FunXMLi.bracedepth != FunXMLi.builder->node_depth() ) { // closing a property. std::string prop = FunXMLi.yystr.substr( 2, FunXMLi.yystr.size() - 3 ); FunXMLi.builder->add_property( prop, FunXMLi.cdata ); } else { // closing an object node. FunXMLi.builder->close_node(); } --FunXMLi.bracedepth; FunXMLi.cdata = ""; if( 0 == FunXMLi.builder->node_depth() ) { // return once we close the first top-level node. return 0; } } .|\n|{SPACE} { FunXMLi.cdata += YYText();} %% --- NEW FILE: select_lexer.flex.at --- %option c++ %{ /** @LICENSE */ /** Searchs the first line of input (consuming it) for a "magic cookie" by which to identify a lexer. */ #define YY_SKIP_YYWRAP 1 int yywrap() { return 1; } #include <cassert> #include <iostream> #include <string> #include <sstream> #include <s11n/s11n-macros.h> // COUT/CERR // #include <s11n/S11nNodeBuilder.h> #include <s11n/flex_lexers.h> #include <s11n/s11n_globals.h> // first_token_of_file() #if HAVE_CONFIG_H # include "config.h" #endif #if HAVE_ZLIB # include <zlib.h> # include <s11n/gzstream.h> #else # include <fstream> #endif using std::cin; using std::cerr; using std::cout; using std::endl; namespace s11n { FlexTreeBuilder * m_selected_builder = 0; FlexTreeBuilder * FlexTreeBuilder::loadBuilder( const std::string & fname ) { m_selected_builder = 0; std::string token = s11n::first_token_of_file( fname, true ); //COUT << "loadBuilder() magic cookie="<<token<<std::endl; std::istringstream cookiestream(token); select_lexerFlexLexer fl; fl.switch_streams( &cookiestream, 0 ); fl.yylex(); //COUT << "m_selected_builder="<<hex<<m_selected_builder<<""<<std::endl; if( ! m_selected_builder ) return NULL; #if HAVE_ZLIB s11n::igzstream is( fname.c_str() ); #else std::ifstream is( fname.c_str() ); #endif bool killit = false; FlexTreeBuilder * ret = m_selected_builder; if( ! ret->load( is ) ) { killit = true; } //COUT << killit << endl; if( ! m_selected_builder->root_node() ) { // no point, is there? killit = true; } //COUT << killit << endl; if( killit ) { delete( m_selected_builder ); m_selected_builder = 0; ret = 0; } //COUT << "selected builder="<<hex<<ret<<""<<std::endl; return ret; } }; %} @COMMON_DEFINITIONS@ // COMMON_DEFINITIONS: See common_flex_definitions.in %% ^"<!DOCTYPE SerialTree>" { // fun-xml s11n::m_selected_builder = new s11n::FunXML(); return 0; } ^"#SerialTree 1" { // fun-txt s11n::m_selected_builder = new s11n::FunTxt(); return 0; } ^"<!DOCTYPE s11n::simplexml>" { // s11n s11n::m_selected_builder = new s11n::SimpleXMLFlexer(); return 0; } .|\n { s11n::m_selected_builder = NULL; return 0; } %% #if SELECT_LEXER_DO_MAIN int main() { FlexLexer * fl = new select_lexerFlexLexer(); while( fl->yylex() ); delete( fl ); } #endif --- NEW FILE: simplexml.flex.at --- %option c++ %{ /** @LICENSE */ /** This flexer builds S11nNode trees out of a subset of XML. Most basic XML constructs are supported. XML CDATA, which is not directly supported by the S11nNode interface, is stored in the property named "CDATA", available via S11nNode::getString("CDATA"). */ #define YY_SKIP_YYWRAP 1 int yywrap() { return 1; } #include <cassert> #include <iostream> #include <string> #include <stack> #include <s11n/s11n_globals.h> // normalize_string() #include <s11n/flex_lexers.h> #include <s11n/KeyValueParser.h> using std::cin; using std::cerr; using std::cout; using std::endl; class simplexml_internal { public: unsigned long bracedepth; std::string nodename; std::string nodeclass; std::string yystr; //std::string cdata; s11n::S11nNodeBuilder * builder; typedef std::stack<std::string> StringStack; StringStack cdata; void cleanup() { nodename = ""; nodeclass = ""; yystr = ""; for( StringStack::size_type i = 0; i < cdata.size(); ++i ) cdata.pop(); // builder will be freed elsewhere. } }; // struct simplexml_internal simplexml_internal sxmli; namespace s11n { FlexLexer * SimpleXMLFlexer::lexer() { FlexLexer * fp = 0; fp = this->FlexTreeBuilder::lexer(); if( fp ) return fp; // else first-time setup: this->reset(); return this->FlexTreeBuilder::lexer(); } void SimpleXMLFlexer::reset() { this->FlexTreeBuilder::reset(); sxmli.bracedepth = 0; FlexLexer * fp = new simplexmlFlexLexer(); this->FlexTreeBuilder::lexer(fp); fp->set_debug( 1 ); sxmli.builder = this->builder(); } } // namespace s11n static s11n::KeyValueParser sxml_kvp; int sxml_close_node() { // closing something // where to store this? if( ! sxmli.cdata.empty() ) sxmli.builder->add_property( "CDATA", sxmli.cdata ); if( sxmli.bracedepth == sxmli.builder->node_depth() ) { std::string cd = sxmli.cdata.top(); s11n::trim_string( cd ); if( ! cd.empty() ) sxmli.builder->add_property( "CDATA", cd ); sxmli.builder->close_node(); } if( 0 == sxmli.builder->node_depth() ) { // return once we close the first top-level node. sxmli.cleanup(); return 0; } sxmli.cdata.pop(); --sxmli.bracedepth; return sxmli.builder->node_depth(); } %} @COMMON_DEFINITIONS@ // COMMON_DEFINITIONS: See common_flex_definitions.in %x IN_ELEM_DECL %x IN_COMMENT %x IN_CDATA %% // \<\!.+\n { // continue; // } "<?"[^>]+ {;} "<![CDATA[" { BEGIN IN_CDATA; } <IN_CDATA>"]]>" { BEGIN 0; } <INITIAL>^({SPACE}+) {continue;} <INITIAL>({SPACE}+)$ {continue;} <IN_CDATA>(.|\n) { if( ! sxmli.cdata.empty() ) sxmli.cdata.top() += YYText(); continue; } "<"{WORD} { sxmli.yystr = YYText(); //COUT << "opening element? "<<sxmli.yystr<<std::endl; sxmli.nodename = sxmli.yystr.substr( 1 ); sxmli.builder->open_node("NoClassYet", sxmli.nodename); sxmli.cdata.push(std::string()); ++sxmli.bracedepth; BEGIN IN_ELEM_DECL; } <IN_ELEM_DECL>{WORD}=({QUOTED_STRING}|{RGB_COLOR}|{WORD}|({DIGIT}+)|([a-zA-Z_0-9]+)) { // foo if( ! sxml_kvp.parse( YYText() ) ) { CERR << "syntax error: could not parse key=value from ["<<YYText()<<"]"<<std::endl; sxmli.cleanup(); return 0; } std::string attr = sxml_kvp.value(); s11n::normalize_string( attr ); std::string k = sxml_kvp.key(); if( k == "class" ) { sxmli.builder->current_node()->implClass( attr ); } else { sxmli.builder->add_property( k, attr ); } } <IN_ELEM_DECL>\/{SPACE}*> { if( 0 == sxml_close_node() ) return 0; BEGIN 0; } <IN_ELEM_DECL>">" { // closing element decl. //sxmli.yystr = YYText(); BEGIN 0; } <IN_ELEM_DECL>"<" { CERR << "syntax error: we found a '<' character inside an element declaration." << std::endl; sxmli.cleanup(); return 0; ; } <IN_ELEM_DECL>(.|\n) {;} \<\/{WORD}({SPACE}*)\> { if( 0 == sxml_close_node() ) return 0; } "<!--" { //COUT << "entering comment..." << std::endl; BEGIN IN_COMMENT; } <IN_COMMENT>"<!--" { CERR << "syntax error: you may not have comments within comments." << std::endl; sxmli.cleanup(); return 0; //BEGIN 0; } <IN_COMMENT>"-->" { //COUT << "... exiting comment" << std::endl; BEGIN 0; } <IN_COMMENT>[.\n] {;} .|\n { if( ! sxmli.cdata.empty() ) sxmli.cdata.top() += YYText(); } %% #if SIMPLEXML_DO_MAIN #include <s11n/FlexShell.h> #include <s11n/ELib.h> using namespace s11n; int main( int argc, char ** argv ) { // ELib::init( argc, argv ); // FlexShell sh; // sh.readline().loadHistory( ELib::s11nHome( "simplexml.history" ) ); SimpleXMLFlexer xmlflex; FlexLexer * lexer = xmlflex.lexer(); while( 0 != (lexer->yylex() ) ); // sh.lexer( lexer ); // while( ! sh.readline( ELib::args().getString("$0") + ":>", FlexShell::dummy_token_callback ).empty() ); std::cout << endl; if( S11nNode * node = xmlflex.root_node() ) { node->serializeProperties( *node ); COUT << "Re-serialized:\n"; S11nNodeSerializerSimpleXML::save( *node, std::cout ); S11nNodeSerializerFunTxt::save( *node, std::cout ); S11nNodeSerializerFunXML::save( *node, std::cout ); } return 0; } #endif |
From: <sg...@us...> - 2003-09-27 22:37:09
|
Update of /cvsroot/libfunutil/libfunutil/include/s11n In directory sc8-pr-cvs1:/tmp/cvs-serv7806/include/s11n Added Files: Makefile Log Message: egg --- NEW FILE: Makefile --- include toc.make # this file is primarily a placeholder for an otherwise-empty dir. |
From: <sg...@us...> - 2003-09-27 22:35:52
|
Update of /cvsroot/libfunutil/libfunutil/lib/s11n/parsers In directory sc8-pr-cvs1:/tmp/cvs-serv7627/lib/s11n/parsers Log Message: Directory /cvsroot/libfunutil/libfunutil/lib/s11n/parsers added to the repository |
From: <sg...@us...> - 2003-09-27 22:35:42
|
Update of /cvsroot/libfunutil/libfunutil/lib/s11n In directory sc8-pr-cvs1:/tmp/cvs-serv7604/lib/s11n Log Message: Directory /cvsroot/libfunutil/libfunutil/lib/s11n added to the repository |
From: <sg...@us...> - 2003-09-27 22:35:30
|
Update of /cvsroot/libfunutil/libfunutil/tests/s11n In directory sc8-pr-cvs1:/tmp/cvs-serv7575/tests/s11n Log Message: Directory /cvsroot/libfunutil/libfunutil/tests/s11n added to the repository |
From: <sg...@us...> - 2003-09-27 22:35:18
|
Update of /cvsroot/libfunutil/libfunutil/include/s11n In directory sc8-pr-cvs1:/tmp/cvs-serv7492/include/s11n Log Message: Directory /cvsroot/libfunutil/libfunutil/include/s11n added to the repository |
From: <sg...@us...> - 2003-09-27 22:34:52
|
Update of /cvsroot/libfunutil/libfunutil/toc/tests In directory sc8-pr-cvs1:/tmp/cvs-serv7408/toc/tests Added Files: flex.sh gcc_try_compile.sh zlib.sh Log Message: egg --- NEW FILE: flex.sh --- # toc_run_description = looking for GNU flex toc_find_failok flex || return toc_add_make FLEX=${TOC_FIND_RESULT} toc_find_failok FlexLexer.h /usr/include:/usr/local/include || return return 0 --- NEW FILE: gcc_try_compile.sh --- # toc_run_description = trying to compile $@ # # toc_begin_help = # # Tries to compile $@ using ${CC} and returns the error code which the # compiler returns. $@ may be made up of any flags which you want to # pass to the compilers, such as -I/some/path. # # This code uses ${INCLUDES}. You can easily set it only for the # duration of this test by doing something like the following: # # INCLUDES="-I/path1 -I/path2" toc_run_fail myfile.c # # This is an alternative to using the more verbose approach of saving # INCLUDES, adjusting it, calling this test and re-setting INCLUDES. # # = toc_end_help #test x"$@" = x && { # ^^^ this no workie when, e.g., -I... is passed in, because -I is a flag used by test :/ # echo "usage: try_compile cc_flag|file1.{c,cpp...} [cc_flag|file2...]" # return 1 #} toc_get_make CC CC=${TOC_GET_MAKE} test "x$CC" = x && { echo "This test requires that the config variable CC have been set to point to gcc." echo "Try running the gnu_cpp_tools test, or another test which sets C/C++-related variables, or call toc_add_make CC=/path/to/gcc." return 1 } tmpprefix=.toc.try_compile dotofile=$tmpprefix.o compiler_out=$tmpprefix.out cmd="$CC ${INCLUDES} $@ -c -o $dotofile" echo $cmd > $compiler_out $cmd >> $compiler_out 2>&1 err=$? test -f $dotofile && rm $dotofile test $err != 0 && { echo "Compiler output is in $compiler_out (but will be erased the next time this test is run!)." } || { rm $compiler_out } return $err --- NEW FILE: zlib.sh --- # toc_run_description = looking for zlib # toc_begin_help = # Searches for libz.a and zlib.h in commonly-used locations and # sets the config var HAVE_ZLIB to zero or one. # Pass --disable-zlib to configure to explicitely set # HAVE_ZLIB to zero. # = toc_end_help test x0 = x${configure_enable_zlib} && { echo "zlib explicitely disabled via --disable-zlib." toc_add_config HAVE_ZLIB=0 return 0 } toc_find_failok libz.a ${prefix}/lib:/usr/lib:/usr/local/lib:${LD_LIBRARY_PATH} zlib_a=${TOC_FIND_RESULT} toc_find_failok zlib.h ${prefix}/include:/usr/include:/usr/local/include zlib_h=${TOC_FIND_RESULT} test "x" = "x$zlib_a" -o "x" = "x$zlib_h" HAVE_ZLIB=$? toc_add_config HAVE_ZLIB=$HAVE_ZLIB |
From: <sg...@us...> - 2003-09-27 22:34:35
|
Update of /cvsroot/libfunutil/libfunutil/toc/sbin In directory sc8-pr-cvs1:/tmp/cvs-serv7210/toc/sbin Modified Files: toc_core.sh toconfigure Log Message: massive commit, mainly fixes/changes from the elib tree. Index: toc_core.sh =================================================================== RCS file: /cvsroot/libfunutil/libfunutil/toc/sbin/toc_core.sh,v retrieving revision 1.26 retrieving revision 1.27 diff -u -d -r1.26 -r1.27 --- toc_core.sh 5 Sep 2003 09:33:48 -0000 1.26 +++ toc_core.sh 27 Sep 2003 22:34:03 -0000 1.27 @@ -77,23 +77,27 @@ } function boldecho { # backwards compatibility - toc_boldecho $@ + toc_boldecho "$@" } } # end eye candy TOC_ERR_OK=0 TOC_ERR_ERROR=1 +# OKAY, ERROR and WARNING are "core" emoticons: TOC_EMOTICON_OKAY="${TOC_BOLD_}:-)${_TOC_BOLD}" TOC_EMOTICON_ERROR="${TOC_BOLD_}:-(${_TOC_BOLD}" TOC_EMOTICON_WARNING="${TOC_BOLD_}:-O${_TOC_BOLD}" -# TOC_EMOTICON_WTF="${TOC_BOLD_}:-?${_TOC_BOLD}" + +# "unofficial" emoticons:x +TOC_EMOTICON_GRIEF="${TOC_BOLD_}:'-(${_TOC_BOLD}" +TOC_EMOTICON_WTF="${TOC_BOLD_}:-?${_TOC_BOLD}" function toc_debug { test "$TOC_DEBUG" -ne 0 || return 0; - echo "toc_debug: " $@ 1>&2 + echo "toc_debug: " "$@" 1>&2 return 0 } @@ -346,12 +350,26 @@ # else it returns 0. function toc_find_in_path { - toc_debug toc_find_in_path $@ + toc_debug toc_find_in_path "$@" TOC_FIND_RESULT= # holds the quasi-return value local app=$1 shift local path="$@" test -n "$path" || path="$PATH" + + # EXPERIMENTAL --with-FOO=/path/to/foo support + local foo + local bar + bar=$(echo $app | tr '[\-\.\\/+]' '[_____]') + # ^^^ there's Grief waiting to happen here :/ + eval foo=\$configure_with_${bar} + test x${foo} != x -a x${foo} != x0 -a x${foo} != x1 && { + toc_loudly -n " Using explicit --with-$app: $foo" + app="${foo}" + path="" + } + # /experiment + # strange: when run as: toc_find_in_path ls $PATH # path is space-separated! # echo path=$path @@ -395,13 +413,13 @@ } function toc_add_config { - toc_add_make $@ - toc_add_config_h $@ + toc_add_make "$@" + toc_add_config_h "$@" } function toc_export { # the ultimate in laziness: toc_add_config plus shell export. - toc_debug toc_export $@ - toc_add_config $@ + toc_debug toc_export "$@" + toc_add_config "$@" local args="$@" local k="${args%%=*}" local v="${args##*=}" @@ -435,7 +453,7 @@ { TOC_RUN_DEPTH=$((TOC_RUN_DEPTH + 1)) local depth=${TOC_RUN_DEPTH} - toc_debug "toc_run " $@ + toc_debug "toc_run " "$@" local testname=$1 #${TOC_FIND_RESULT} #TOC_DIR=${TOC_TESTSDIR} local path= @@ -458,10 +476,12 @@ i=$((i + 1)) done toc_boldecho -n " [$showname] " - test -n "$desc" && echo -n $desc + test -n "$desc" && eval "echo -n $desc" + # ^^^ the eval allows us to use $VARS in toc_run_description. as a + # side-effect, however, you must escape ><| in toc_run_description! echo local err=0 - toc_source_test $testname $@ + toc_source_test $testname "$@" err=$? if test ${TOC_FAIL_FAST-0} = 1 -a $err != 0; then toc_die $err "toc_run: TOC_FAIL_FAST is set, and test $testname returned a non-zero error code." @@ -473,10 +493,10 @@ function toc_run_failok { # runs toc_run and warns if there was an error. # It does not exit - it passed back the error code from the test. - toc_debug toc_run_failok $@ + toc_debug toc_run_failok "$@" local testname=$1 local depth=$((TOC_RUN_DEPTH + 1)) - toc_run $@ || { + toc_run "$@" || { local ret=$? toc_loudly -n "[${depth}] " toc_boldecho -n "^^^^^^^^^^ " @@ -491,10 +511,10 @@ function toc_run_fail { # calls toc_run and fails if it returns !0 - toc_debug toc_run_fail $@ + toc_debug toc_run_fail "$@" local testname=$1 local depth=$((TOC_RUN_DEPTH + 1)) - toc_run $@ || { + toc_run "$@" || { local ret=$? toc_loudly -n "[${depth}] " toc_boldecho -n "^^^^^^^^^^ " @@ -514,13 +534,13 @@ # It "returns" the found file in ${TOC_FIND_RESULT}. local bin=$1 shift - path="${@-${PATH}}" + local path="${@-${PATH}}" toc_quietly -n "? find $bin ..." toc_find_in_path $bin $path || { toc_quietly "not found ${TOC_EMOTICON_WARNING}" return 1 } - str= + local str= test "x${TOC_QUIET-0}" = "x0" && str="${TOC_EMOTICON_OKAY}" test "x${TOC_LOUD-0}" != "x0" && str="${TOC_FIND_RESULT}" test -n "$str" && echo " $str" @@ -528,7 +548,7 @@ } function toc_find_fail { # See toc_find_failok(), except this one exits on error - toc_find_failok $@ || toc_die $? toc_find_fail $@ + toc_find_failok "$@" || toc_die $? toc_find_fail "$@" return 0 } @@ -544,7 +564,7 @@ test -f "$sh" || toc_die 1 "toc_source_test $test: $sh not found!" local err=0 toc_debug "toc_source_test sourcing [$sh $@]" - source $sh $@ + source $sh "$@" err=$? return $err } @@ -662,42 +682,68 @@ { # parses $@ for arguments toc can work with. toc_debug "toc_parseargs: Handling command-line arguments: $@" # mostly stolen from the qt 3.1.0 configure script :) + local i=0 + local -a passon # clone of $@ to pass on to TOC_PARSEARGS_CALLBACK while [ "$#" -gt 0 ]; do - VAR= - VAL= - arg="$1" + local arg="$1" shift + passon[${i}]="$arg" + i=$((i + 1)) + local VAR= + local VAL= + #echo arg=$arg case $arg in --help|-?) cat<<-EOF Usage: $0 [--prefix=/path] [--argument=value] [--arg2=val2] ... - See the README file for this package to find out which arguments are supported. - Standard arguments include: EOF -# ^^^^ note usage of hard tabs in the cat command! -cat <<EOF | perl -ne 'm/\t*(.*)\s*\|\s*(.*)/; print " $1\n\t\t$2\n";' +# ^^^^ note usage of hard tabs in the cat data! + +cat <<EOF | perl -ne '$|=1; next unless m|\w|; m/\t*(.*)\s*\|\s*(.*)/; print " $1\n\t\t$2\n";' --help or -? | Show this help. - --prefix=/path | Top-most path for installation. Default: ${prefix} + --prefix=/path | Top-most path for installation. Default=${prefix} --enable-FEATURE=... | Exports config variable configure_enable_FEATURE. - --enable-FEATURE | Equivalent to --enable-FEATURE=1. - --disable-FEATURE | Equivalent to --enable-FEATURE=0. - --with-FEATURE=... | Sets the global variable configure_with_FEATURE. - --with-FEATURE | Equivalent to --with-FEATURE=1. - --without-FEATURE | Equivalent to --with-FEATURE=0. + --enable-FEATURE | Equivalent to --enable-FEATURE=1. + --disable-FEATURE | Equivalent to --enable-FEATURE=0. + --with-FEATURE=... | Sets the config variable configure_with_FEATURE. + --with-FEATURE | Equivalent to --with-FEATURE=1. + --without-FEATURE | Equivalent to --with-FEATURE=0. --XXX=YYY | Exports config variable XXX=YYY. --XXX | Equivalent to --XXX=1. - --toc-quiet,--quiet | Disables some text which may be of arguable utility. - --toc-loud, --loud | Enables some otherwise superfluous information. - --verbose | Enables --loud and disables --quiet + --toc-quiet,--quiet | Makes configure run more quietly. + --toc-loud, --loud | configure will output some otherwise superfluous information. + --verbose | Enables --loud and disables --quiet. --toc-fail-fast | Causes configure to abort if toc_run_failok returns non-zero. - + --toc-debug | Enables debugging output in the configure framework. EOF -# ^^^^ note usage of hard tabs in the cat command! +# ^^^^ note usage of hard tabs in the cat data! + + local help=${TOC_TOPDIR}/toc.${PACKAGE_NAME}.help + test -f $help && { + echo -e "\nHelp options specific to ${PACKAGE_NAME}:\n" + local foo=$(head -1 $help) + local sh=${foo#\#\!} + local hash=${foo%%\!*} + test "x#" = "x$hash" -a "x$hash" != "x$sh" -a "x$sh" != "x" || { + # lookie like no script of some sort. + sh=cat + } + $sh $help + echo "" # just for looks. + } + local help=toc.${PACKAGE_NAME}.help.sh + test -f $help && { + echo "" + echo "Help options specific to this package:" + cat $help + echo "" # just for looks. + } + exit 0 - ;; + ;; # finally end --help --prefix=*) # reserved. VAR=$(echo $arg | sed "s,^--\(.*\)=.*,\1,;") @@ -728,7 +774,7 @@ VAL=$(echo "$arg" | sed "s,^--.*=\(.*\),\1,") VAR=configure_${VAR} ;; - --enable-*|--with-*) + --enable-*|--with-*) # sets configure_with_XXX=1 or configure_enable_XXX=1 VAR=configure_$(echo $arg | sed "s,^--\(.*\),\1,;s,-,_,g") VAL=1 @@ -750,17 +796,15 @@ VAL=0 export $VAR="$VAL" ;; - --*=*) + --*=*) # SOOOOOOO arguable # sets XXX=YYY VAR=$(echo $arg | sed "s,^--\(.*\)=.*,\1,;s,-,_,g") VAL=$(echo $arg | sed "s,^--.*=\(.*\),\1,") - # SOOOOOOO arguable: ;; --*) # this is soooooo arguable # sets XXX=1 VAR=$(echo $arg | sed "s,^--\(.*\),\1,;s,-,_,g;") VAL=1 - # SOOOOOOO arguable: ;; *) toc_boldecho "WARNING: unrecognized option: $arg" @@ -773,6 +817,11 @@ toc_add_config "$VAR=$VAL" } done + + test "x${TOC_PARSEARGS_CALLBACK}" != "x" && { + ${TOC_PARSEARGS_CALLBACK} "${passon[@]}" + return $? + } return 0 } # end parseargs @@ -789,19 +838,17 @@ toc_quietly <<-EOF ${TOC_BOLD_}Emoticon legend:${_TOC_BOLD} - ${TOC_EMOTICON_OKAY} Good news. - ${TOC_EMOTICON_ERROR} Bad news. - ${TOC_EMOTICON_WARNING} A warning, possibly an error, but we - do not yet know if it is fatal. A warning might actually - be an error: this is build tree dependent. + ${TOC_EMOTICON_OKAY} Good News. + ${TOC_EMOTICON_ERROR} Bad News. + ${TOC_EMOTICON_WARNING} A warning, possibly even Bad News, but we do not yet + know if it is fatal: this is build tree dependent. - Note that not all config test failures are fatal: it will stop if - it fails a test which it /needs/ to pass. + Note that not all config test failures are fatal: it will stop if + it fails a test which it /needs/ to pass. EOF # source ${TOC_TOCDIR}/tests/toc_core_tests.sh || { toc_run_fail toc_core_tests || { -# Don't do "toc_run toc_core" because then we don't see the output :/ err=$? echo "Core toc sanity test failed (err=$err). This tree is not toc-capable. ${TOC_EMOTICON_ERROR}" exit $err Index: toconfigure =================================================================== RCS file: /cvsroot/libfunutil/libfunutil/toc/sbin/toconfigure,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- toconfigure 5 Sep 2003 09:32:50 -0000 1.11 +++ toconfigure 27 Sep 2003 22:34:03 -0000 1.12 @@ -58,6 +58,8 @@ toc_add_config_h PACKAGE_VERSION=${PACKAGE_VERSION} toc_add_make PACKAGE_VERSION=${PACKAGE_VERSION} +toc_add_make configure_build_quietly=${build_quietly-0} + # include package-specific configure script. This eases upgrading a project's toc: pkgconfig=${PACKAGE_CONFIGURE_SCRIPT-configure.${PACKAGE_NAME}} test -f $pkgconfig && { @@ -73,12 +75,14 @@ # toc_run_fail toc_configure_finalcheck # toc_configre_finalcheck is arguable :/ + + +# end the configuration process and write out our files... toc_endconfigure | perl -ane '$| = 1; if( ! -f $F[0] ) { print; next; } $fn = $F[0]; $st = $_; $st =~ s|.*\.\.\.\s+||; -# print "\t$F[0]\t\t\t$st"; write; format STDOUT = @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< @<<<<<<<<<<<<<<<<<<<< |
From: <sg...@us...> - 2003-09-27 22:34:35
|
Update of /cvsroot/libfunutil/libfunutil/toc/make In directory sc8-pr-cvs1:/tmp/cvs-serv7210/toc/make Modified Files: cleaner.make cpp_bins.make cpp_dynamic_libs.make cpp_static_libs.make dist.make flex.make makerules.BIN_PROGRAMS makerules.SHARED_LIBS makerules.STATIC_LIBS subdirs_traverser.make toc_functions.make Log Message: massive commit, mainly fixes/changes from the elib tree. Index: cleaner.make =================================================================== RCS file: /cvsroot/libfunutil/libfunutil/toc/make/cleaner.make,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- cleaner.make 5 Sep 2003 09:32:14 -0000 1.7 +++ cleaner.make 27 Sep 2003 22:34:02 -0000 1.8 @@ -25,8 +25,10 @@ CLEAN_FILES += $(DEPS_FILE) $(DIST_LISTFILE) +###################################################################### +# toc_clean_files call()able function: deletes all files passed in via +# $(1). toc_clean_files = test "x$(1)" = "x" && exit 0; \ - echo Cleaning: $(1); \ for x in $(1) ""; do test -z "$${x}" && continue; \ test -w $$x || continue; \ rm $$x || exit; \ @@ -41,9 +43,25 @@ clean-.: clean-subdirs - @$(call toc_clean_files,$(wildcard $(CLEAN_FILES))) +ifeq (1,$(configure_build_quietly)) + @echo "Cleaning up..."; \ + $(call toc_clean_files,$(wildcard $(CLEAN_FILES))) +else + @echo "Cleaning up: $(wildcard $(CLEAN_FILES))"; \ + $(call toc_clean_files,$(wildcard $(CLEAN_FILES))) +# i hate the duplicate wildcard, but i can't pass shell-expanded vars +# to $(call ...). +endif + distclean-.: distclean-subdirs - @$(call toc_clean_files,$(wildcard $(CLEAN_FILES) $(DISTCLEAN_FILES))) + @echo -n "Cleaning up... " +ifeq (1,$(configure_build_quietly)) + @$(call toc_clean_files,$(wildcard $(CLEAN_FILES) $(DISTCLEAN_FILES))); \ + echo +else + @echo $(wildcard $(CLEAN_FILES) $(DISTCLEAN_FILES)); \ + $(call toc_clean_files,$(wildcard $(CLEAN_FILES) $(DISTCLEAN_FILES))) +endif subdirs-clean: # implemented elsewhere subdirs-distclean: # implemented elsewhere Index: cpp_bins.make =================================================================== RCS file: /cvsroot/libfunutil/libfunutil/toc/make/cpp_bins.make,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- cpp_bins.make 31 Aug 2003 20:23:01 -0000 1.7 +++ cpp_bins.make 27 Sep 2003 22:34:03 -0000 1.8 @@ -28,7 +28,7 @@ # $1 = binary file name # $2 = optional arguments to linker. # list of objects to link is derived from $($(1)_bin_OBJECTS) and $(BIN_PROGRAMS_OBJECTS) -toc_link_binary = $(CXX) $(LDFLAGS) -o $(1) $($(1)_bin_OBJECTS) $(BIN_PROGRAMS_OBJECTS) $(BIN_PROGRAMS_LDADD) $($(1)_bin_LDADD) $(2) +toc_link_binary = $(CXX) -o $(1) $($(1)_bin_OBJECTS) $(BIN_PROGRAMS_OBJECTS) $(LDFLAGS) $($(1)_bin_LDADD) $(BIN_PROGRAMS_LDADD) $(2) ifneq (,$(BIN_PROGRAMS)) Index: cpp_dynamic_libs.make =================================================================== RCS file: /cvsroot/libfunutil/libfunutil/toc/make/cpp_dynamic_libs.make,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- cpp_dynamic_libs.make 1 Sep 2003 04:57:32 -0000 1.10 +++ cpp_dynamic_libs.make 27 Sep 2003 22:34:03 -0000 1.11 @@ -6,11 +6,14 @@ # foo_so_OBJECTS = list of object files to link to foo.so # foo_so_LDADD = # optional libraries passed to linker (e.g., -lstdc++) # foo_so_LDFLAGS = # optional args to linker -# foo_so_MAJOR = 0 # major version number -# foo_so_MINOR = 0 # minor version number -# foo_so_PATCH = 1 # patch version number +# foo_so_VERSION = # optional Major.Minor.Patch # e.g. "1.0.1" it MUST match this format! # include $(toc_makesdir)/cpp_dynamic_libs.make # +# If foo_so_VERSION is not set then no numbered symlinks will be created. +# +# Run: +# all: lib-shared +# # Effect: # Creates foo.so and foo.so<version> by linking $(foo_so_OBJECTS). It # also sets up install/uninstall rules for handling the symlinks. @@ -22,12 +25,16 @@ # $2 = extra args to the linker toc_link_shared_lib = { soname=$(1).so; wholename=$${soname}.$($(1)_so_MAJOR).$($(1)_so_MINOR).$($(1)_so_PATCH); \ so_major=$${soname}.$($(1)_so_MAJOR); \ - set -x; \ - $(CXX) $(LDFLAGS) $($(1)_LDFLAGS) -o $${wholename} -export-dynamic -shared \ - -Wl,-soname,$${so_major} $($(1)_so_OBJECTS) $(SHARED_LIBS_OBJECTS) $($(1)_so_LDADD) $(2) || exit; \ - ln -fs $${wholename} $${soname}.$($(1)_so_MAJOR).$($(1)_so_MINOR); \ - ln -fs $${wholename} $${soname}.$($(1)_so_MAJOR); \ - ln -fs $${wholename} $${soname}; \ + test x = x$($(1)_so_MAJOR) && wholename=$${soname}; \ + cmd="$(CXX) $(LDFLAGS) $($(1)_LDFLAGS) -o $${wholename} -export-dynamic -shared \ + -Wl,-soname,$${so_major} $($(1)_so_OBJECTS) $(SHARED_LIBS_OBJECTS) $(SHARED_LIBS_LDADD) $($(1)_so_LDADD) $(2)"; \ + test x1 = x$(configure_build_quietly) || echo $$cmd; \ + $$cmd || exit; \ + test x = x$($(1)_so_MAJOR) || { \ + ln -fs $${wholename} $${soname}.$($(1)_so_MAJOR).$($(1)_so_MINOR); \ + ln -fs $${wholename} $${soname}.$($(1)_so_MAJOR); \ + ln -fs $${wholename} $${soname}; \ + }; \ } # symlinking methods: # method 1: @@ -50,8 +57,6 @@ # ; do \ # ln -fs $${wholename} $$l; \ # done; \ - -# echo "$$soname version: $($(1)_so_MAJOR) $($(1)_so_MINOR) $($(1)_so_PATCH)"; ifneq ($(SHARED_LIBS),) SHARED_LIBS_SOFILES = $(patsubst %,%.so,$(SHARED_LIBS)) Index: cpp_static_libs.make =================================================================== RCS file: /cvsroot/libfunutil/libfunutil/toc/make/cpp_static_libs.make,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- cpp_static_libs.make 1 Sep 2003 04:57:46 -0000 1.7 +++ cpp_static_libs.make 27 Sep 2003 22:34:03 -0000 1.8 @@ -20,7 +20,10 @@ STATIC_LIBS_A = $(patsubst %,%.a,$(STATIC_LIBS)) CLEAN_FILES += $(STATIC_LIBS_A) -toc_link_static_lib = $(AR) cqs $(1).a $($(1)_a_OBJECTS) $(STATIC_LIBS_OBJECTS) +# toc_link_static_lib call()able: +# $1 = base name (e.g., foo) +# links $(1).a from $($(1)_a_OBJECTS) and $(STATIC_LIBS_OBJECTS) +toc_link_static_lib = $(AR) crs $(1).a $($(1)_a_OBJECTS) $(STATIC_LIBS_OBJECTS) ifneq (,$(STATIC_LIBS_A)) Index: dist.make =================================================================== RCS file: /cvsroot/libfunutil/libfunutil/toc/make/dist.make,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- dist.make 31 Aug 2003 20:23:28 -0000 1.10 +++ dist.make 27 Sep 2003 22:34:03 -0000 1.11 @@ -4,12 +4,16 @@ # it takes a list of files/dirs to create a distribution tarball from. # This snippet requires a filesystem-valid $(PACKAGE_NAME)-$(PACKAGE_VERSION) # combination +# +# You may set sever configure_dist_xxx vars to configure which packages it +# creates - see the code below for details. + DIST_FILES_FILE = .toc.DIST_FILES CLEAN_FILES += $(wildcard $(DIST_FILES_FILE)) -dist_find_bin = $(firstword $(wildcard $(addsuffix /$(1),$(subst :, ,$(toc_tocdir)/bin:$(PATH))))) -FORCE: +# dist_find_bin: helper function to find $(1) in an adjusted PATH +dist_find_bin = $(firstword $(wildcard $(addsuffix /$(1),$(subst :, ,$(toc_tocdir)/bin:$(PATH))))) TOC_MAKEDIST_BIN ?= $(call dist_find_bin,makedist) ifeq (,$(wildcard $(TOC_MAKEDIST_BIN))) @@ -19,9 +23,9 @@ dist-.: $(DIST_FILES_FILE) $(DIST_FILES_FILE): FORCE Makefile - @test -z "$(DIST_FILES)" && exit 0; \ + @test "x" = "x$(DIST_FILES)" && exit 0; \ pwd=$$(pwd); \ - for f in "" $(DIST_FILES); do test -z "$$f" && continue; \ + for f in "" $(DIST_FILES); do test "x" = "x$$f" && continue; \ echo $$pwd/$$f; \ done > $@; @@ -52,23 +56,19 @@ dist-compress: dist-.: $(DIST_FILES_TARBALL) dist-compress -configure_dist_use_gzip ?= 0 -configure_dist_use_bzip ?= 0 -configure_dist_use_zip ?= 0 - -GZIP_BIN = $(call dist_find_bin,gzip) +GZIP_BIN ?= $(call dist_find_bin,gzip) ifneq (,$(GZIP_BIN)) -configure_dist_use_gzip = 1 +configure_dist_use_gzip ?= 1 endif -BZIP_BIN = $(call dist_find_bin,bzip2) +BZIP_BIN ?= $(call dist_find_bin,bzip2) ifneq (,$(BZIP_BIN)) -configure_dist_use_bzip = 1 +configure_dist_use_bzip ?= 1 endif -ZIP_BIN = $(call dist_find_bin,zip) +ZIP_BIN ?= $(call dist_find_bin,zip) ifneq (,$(ZIP_BIN)) -configure_dist_use_zip = 1 +configure_dist_use_zip ?= 1 endif ifeq (1,$(configure_dist_use_gzip)) @@ -123,12 +123,11 @@ ./configure $(DIST_TESTDIST_ARGS) && make || exit $$? @echo "$@ $(PACKAGE_NAME)-$(PACKAGE_VERSION) completed. $(TOC_EMOTICON_OKAY)" -MD5_BIN = $(call dist_find_bin,md5sum*) +MD5_BIN ?= $(call dist_find_bin,md5sum*) ifeq (,$(MD5_BIN)) $(warning MD5_BIN not pointing to md5sum application. Skipping md5-related checks.) else MD5_LIST = md5.sums.$(DIST_NAME) - md5check-%: @echo "Checking distribution md5 sums against $*..." @$(MD5_BIN) --check $* | grep FAILED || exit 0 && exit 1 Index: flex.make =================================================================== RCS file: /cvsroot/libfunutil/libfunutil/toc/make/flex.make,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- flex.make 5 Sep 2003 09:35:28 -0000 1.1 +++ flex.make 27 Sep 2003 22:34:03 -0000 1.2 @@ -1,18 +1,23 @@ #!make # snippet to compile .flex files into .cpp - +# # usage: # define: # FLEXES = foo bar -# all: flex_files +# FLEXES_ARGS = optional args to pass to flex. +# foo_FLEXES_ARGS = optional args for foo.flex +# +# all: flexes +# # You must have foo.flex for each $(FLEXES) and foo.flex.cpp will # be generated. It will be "massaged" a bit to allow it to compile -# under newer GCC versions (3.2+ish, i think). +# under newer GCC versions (3.x). +# -FLEX_CPPFILE_SUFFIX = .cpp +FLEX_CPPFILE_SUFFIX ?= .cpp FLEX_FILE_SUFFIX ?= .flex -%$(FLEX_FILE_SUFFIX):# undefine make's implicite rule +%$(FLEX_FILE_SUFFIX):# undefine make's implicit rule FLEX_MAKEFILE = $(toc_makesdir)/flex.make ifneq (,$(FLEXES)) @@ -21,21 +26,26 @@ ifeq (,$(FLEX_BIN)) $(error This makefile snippet requires that 'flex' be found in the PATH!) endif + + FLEX_FLEX_FILES = $(addsuffix $(FLEX_FILE_SUFFIX),$(FLEXES)) FLEX_CPP_FILES = $(addsuffix $(FLEX_CPPFILE_SUFFIX),$(FLEX_FLEX_FILES)) # $(FLEX_FLEX_FILES): Makefile # %.flex: Makefile %$(FLEX_FILE_SUFFIX)$(FLEX_CPPFILE_SUFFIX): %$(FLEX_FILE_SUFFIX) $(FLEX_MAKEFILE) Makefile - @echo "Flexing $< to $@, plus doing iostream hacks :/."; \ - flex -+ -t $< | \ + @cmd='$(FLEX_BIN) $(FLEXES_ARGS) $($(basename $(patsubst %$(FLEX_FILESUFFIX)$(FLEX_CPPFILE_SUFFIX),%,$@))_FLEXES_ARGS) -t $< '; \ + echo $$cmd '> $@'; \ + $$cmd | \ perl -p \ -e 's/iostream\.h/iostream/;' \ -e 'next if m/iostream/;' \ -e 'next if m/::[io]stream/;' \ -e 's/(ostream|istream)([^\.])/std::$$1$$2/g;' > $@ -CLEAN_FILES += $(FLEX_CPP_FILES) +# @echo "Flexing $< to $@, plus doing iostream hacks :/."; + +CLEAN_FILES += $(FLEX_CPP_FILES) $(FLEX_FLEX_FILES) flexes: $(FLEX_CPP_FILES) Index: makerules.BIN_PROGRAMS =================================================================== RCS file: /cvsroot/libfunutil/libfunutil/toc/make/makerules.BIN_PROGRAMS,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- makerules.BIN_PROGRAMS 1 Sep 2003 00:19:42 -0000 1.3 +++ makerules.BIN_PROGRAMS 27 Sep 2003 22:34:03 -0000 1.4 @@ -9,7 +9,13 @@ for t in $@; do cat <<EOF $t: \$(BIN_PROGRAMS_COMMON_DEPS) \$(${t}_bin_OBJECTS) - @echo "Linking binary [$t]."; set -x; \$(call toc_link_binary,${t},) + @echo "Linking binary [$t]."; +ifeq (1,\$(configure_build_quietly)) + @\$(call toc_link_binary,${t},) +else + \$(call toc_link_binary,${t},) +endif + CLEAN_FILES += $t bin-$t: $t bins: bin-$t Index: makerules.SHARED_LIBS =================================================================== RCS file: /cvsroot/libfunutil/libfunutil/toc/make/makerules.SHARED_LIBS,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- makerules.SHARED_LIBS 1 Sep 2003 04:59:01 -0000 1.2 +++ makerules.SHARED_LIBS 27 Sep 2003 22:34:03 -0000 1.3 @@ -10,26 +10,34 @@ for t in $@; do sofile=$t.so cat <<EOF -${t}_so_VERSION ?= 0.0.0 +# ${t}_so_VERSION ?= 0.0.0 +ifneq (,\$(${t}_so_VERSION)) ${t}_so_MAJOR ?= \$(word 1,\$(subst ., ,\$(${t}_so_VERSION))) ${t}_so_MINOR ?= \$(word 2,\$(subst ., ,\$(${t}_so_VERSION))) ${t}_so_PATCH ?= \$(word 3,\$(subst ., ,\$(${t}_so_VERSION))) +endif ${sofile}: \$(SHARED_LIBS_COMMON_DEPS) \$(${t}_so_OBJECTS) - @echo "Dynamically linking library [$@]"; \\ - \$(call toc_link_shared_lib,${t}) + @echo "Dynamically linking library [${t}]..." + @\$(call toc_link_shared_lib,${t}) +ifneq (,\$(${t}_so_VERSION)) install-so-${sofile}: @\$(call toc_make_install_so,${sofile},\$(${t}_so_MAJOR),\$(${t}_so_MINOR),\$(${t}_so_PATCH),\$(INSTALL_LIBEXECS_DEST)) uninstall-so-${sofile}: @\$(call toc_make_uninstall,${sofile} ${sofile}.\$(${t}_so_MAJOR) ${sofile}.\$(${t}_so_MAJOR).\$(${t}_so_MINOR) ${sofile}.\$(${t}_so_MAJOR).\$(${t}_so_MINOR).\$(${t}_so_PATCH),\$(INSTALL_LIBEXECS_DEST)) +else +INSTALL_LIBEXECS += ${sofile} +install-so-${sofile}: +uninstall-so-${sofile}: +endif install-LIBEXECS: install-so-${sofile} uninstall-LIBEXECS: uninstall-so-${sofile} - -libs-static: lib-${t} +lib-${t}: ${sofile} +libs-shared: lib-${t} EOF done Index: makerules.STATIC_LIBS =================================================================== RCS file: /cvsroot/libfunutil/libfunutil/toc/make/makerules.STATIC_LIBS,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- makerules.STATIC_LIBS 28 Aug 2003 09:16:56 -0000 1.1 +++ makerules.STATIC_LIBS 27 Sep 2003 22:34:03 -0000 1.2 @@ -11,8 +11,13 @@ afile=$t.a cat <<EOF ${afile}: \$(STATIC_LIBS_COMMON_DEPS) \$(${t}_a_OBJECTS) - @echo "Linking static library [$@]."; set -x; \\ + @echo "Statically linking library [${t}]..." +ifeq (1,\$(configure_build_quietly)) + @\$(call toc_link_static_lib,${t}) +else \$(call toc_link_static_lib,${t}) +endif + lib-${t}: ${afile} libs-static: lib-${t} INSTALL_LIBS += ${afile} Index: subdirs_traverser.make =================================================================== RCS file: /cvsroot/libfunutil/libfunutil/toc/make/subdirs_traverser.make,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- subdirs_traverser.make 5 Sep 2003 09:31:00 -0000 1.12 +++ subdirs_traverser.make 27 Sep 2003 22:34:03 -0000 1.13 @@ -18,18 +18,21 @@ # toc_make_subdirs call()able function: # $1 = list of dirs # $2 = target -# MAKE_NOP_ARG = --no-print-directory +ifeq (1,$(configure_build_quietly)) +MAKE_NOP_ARG = --no-print-directory +endif toc_make_subdirs = \ test "x$(1)" = "x" && exit 0; \ tgt="$(2)"; test x = "x$$tgt" && tgt="all"; \ for b in $(1) "x"; do test "x" = "$$b" && break; \ pwd=$$(pwd); \ - cd $$pwd/$$b || exit; \ echo "Making $$tgt in $$pwd/$${b}"; \ + cd $$pwd/$$b || exit; \ ${MAKE} $(MAKE_NOP_ARG) $$tgt || exit; \ cd $$pwd || exit; \ done + .PHONY: subdirs distclean-subdirs clean-subdirs $(SUBDIRS) # note that this only works for subdirs defined BEFORE including this file: @@ -44,9 +47,9 @@ subdirs-%: ## calls $* target in all $(SUBDIRS) @$(call toc_make_subdirs,$(SUBDIRS),$*) -subdirs: $(addprefix subdir-,$(SUBDIRS)) -#subdirs: subdirs-all -# ${MAKE} $(addprefix subdir-,$(SUBDIRS)) +#subdirs: $(addprefix subdir-,$(SUBDIRS)) +subdirs: subdirs-all +# @${MAKE} $(addprefix subdir-,$(SUBDIRS)) #subdirs-all # @$(call toc_make_subdirs,$(SUBDIRS),all) Index: toc_functions.make =================================================================== RCS file: /cvsroot/libfunutil/libfunutil/toc/make/toc_functions.make,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- toc_functions.make 5 Sep 2003 09:31:44 -0000 1.2 +++ toc_functions.make 27 Sep 2003 22:34:03 -0000 1.3 @@ -29,7 +29,11 @@ # .toc.foo.deps: # $(toc_generate_rules,foo,arg1=val1 -arg2) # Executes script $(toc_makesdir)/makerules.foo, passing it $(2). -toc_generate_rules = $(toc_makesdir)/makerules.$(1) $(2) +toc_generate_rules = $(SHELL) $(toc_makesdir)/makerules.$(1) $(2) +# the $(SHELL) prefix here is a kludge: systems where /bin/sh is Bourne +# fail to build, but the nature of the errors makes it quite difficult +# to track down where the failure is. The side-effect of this kludge +# is that makerules.foo must be a shell script. :/ ###################################################################### # toc_get_makefile_var call()able: @@ -42,16 +46,43 @@ # toc_compile_c_binary call()able function: # compiles/links list of source files [$($(1)_bin_SOURCES) $($(1)_bin_OBJECTS)and $(2)] # to create $(1). It uses the optional $($(1)_bin_CFLAGS). -toc_compile_c_binary = $(CC) $(C_BINS_FROM_SOURCES_CFLAGS) $(CFLAGS) $($(1)_bin_CFLAGS) -o $(1) $($(1)_bin_SOURCES) $($(1)_bin_OBJECTS) $(2) $(C_BINS_FROM_SOURCES_LFLAGS) $($(1)_bin_LFLAGS) - +toc_compile_c_binary = $(CC) $(C_BINS_FROM_SOURCES_CFLAGS) $(CFLAGS) $($(1)_bin_CFLAGS) -o $(1) $($(1)_bin_SOURCES) $($(1)_bin_OBJECTS) $(2) $(C_BINS_FROM_SOURCES_LFLAGS) $(LDFLAGS) $($(1)_bin_LFLAGS) +# does $(LDFLAGS) /really/ belong here??? ###################################################################### # toc_made_c_deps call()able function: -# generates dependencies for c/c++ files. +# generates make dependencies for c/c++ files. # $1 = C/C++ sources to process. # $2 = INCLUDES (e.g., -I. -I/usr/include, with or without the -I). # $2 defaults to $(INCLUDES). toc_make_c_deps = inc="$(patsubst %,-I%,$(wildcard $(patsubst -I%,%,$(2))))"; \ - test -z "$$inc" && inc="$(INCLUDES)"; \ + test "x$$inc" = "x" && inc="$(INCLUDES)"; \ $(DEPSGEN_BIN) $$inc -- $(1) +# the $(wildcard) oddness above is to remove duplicate entires and invalid +# dirs (mkdeps no likie invalid ones). +# maintenance note: $(DEPSGEN_BIN) comes from deps.make + +###################################################################### +# Experimental override of %.o:%.cpp +COMPILE_COMMAND_CXX = $(CXX) $(CXXFLAGS) $($(subst .,_,$<)_CXXFLAGS) \ + $(CPPFLAGS) $($(subst .,_,$<)_CPPFLAGS) $(TARGET_ARCH) -c -o $@ $< +%.o: %.cpp +ifeq (1,$(configure_build_quietly)) + @echo "Compiling $<..."; \ + $(COMPILE_COMMAND_CXX) +else + $(COMPILE_COMMAND_CXX) +endif + +###################################################################### +# Experimental override of %.o:%.c +COMPILE_COMMAND_C = $(CC) $(CFLAGS) $($(subst .,_,$<)_CFLAGS) \ + $(CPPFLAGS) $($(subst .,_,$<)_CPPFLAGS) $(TARGET_ARCH) -c -o $@ $< +%.o: %.c +ifeq (1,$(configure_build_quietly)) + @echo "Compiling $<..."; \ + $(COMPILE_COMMAND_C) +else + $(COMPILE_COMMAND_C) +endif |
Update of /cvsroot/libfunutil/libfunutil/toc/tests In directory sc8-pr-cvs1:/tmp/cvs-serv7210/toc/tests Modified Files: Makefile awk.sh gnu_cpp_tools.sh qt_if_enabled.sh readline.sh toc_core_tests.sh toc_project_makefile.sh Log Message: massive commit, mainly fixes/changes from the elib tree. Index: Makefile =================================================================== RCS file: /cvsroot/libfunutil/libfunutil/toc/tests/Makefile,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- Makefile 5 Aug 2003 09:27:43 -0000 1.1.1.1 +++ Makefile 27 Sep 2003 22:34:03 -0000 1.2 @@ -1,4 +1,7 @@ include toc.make +SUBDIRS = cpp DIST_FILES += $(wildcard *.sh) + +all: subdirs Index: awk.sh =================================================================== RCS file: /cvsroot/libfunutil/libfunutil/toc/tests/awk.sh,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- awk.sh 31 Aug 2003 00:42:50 -0000 1.3 +++ awk.sh 27 Sep 2003 22:34:03 -0000 1.4 @@ -1,6 +1,6 @@ -# awk? +# toc_run_description = looking for gawk/awk/nawk err=0 -toc_find_failok awk || toc_find_failok gawk || toc_find_failok nawk || err=1 +toc_find_failok gawk || toc_find_failok awk || toc_find_failok nawk || err=1 toc_add_make AWK=$TOC_FIND_RESULT return $err Index: gnu_cpp_tools.sh =================================================================== RCS file: /cvsroot/libfunutil/libfunutil/toc/tests/gnu_cpp_tools.sh,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- gnu_cpp_tools.sh 5 Sep 2003 09:34:00 -0000 1.10 +++ gnu_cpp_tools.sh 27 Sep 2003 22:34:03 -0000 1.11 @@ -1,4 +1,4 @@ -# toc_run_description = looking for gcc, ld, and maybe other compilation-related tools +# toc_run_description = looking for GNU C/C++ compiler/linker tools. # toc_begin_help = # It takes the following configure arguments: # --enable-debug causes stuff to be built -g instead of -02. This is a @@ -11,6 +11,11 @@ # # It calls toc_add_make for the following: # - CC /path/to/gcc? +# - LD /path/to/ld +# - CXX /path/to/g++ +# - AR /path/to/ar +# - NM /path/to/nm (optional component) +# - STRIP /path/to/strip (optional component) # - INCLUDES probably empty # - CPPFLAGS probably empty # - OPT -g or -O2 (or some other value specified by --enable-debug) @@ -27,12 +32,22 @@ ; do key=${foo%%-*} var=${foo##*-} - toc_find_fail $key || { - echo "Couldn't find required app: $foo in PATH [$PATH]" + toc_find_failok $key || { + echo "Couldn't find required app: $key in PATH [$PATH]" return 1 } toc_add_make $var=${TOC_FIND_RESULT} done + +for foo in \ + nm-NM strip-STRIP \ + ; do + key=${foo%%-*} + var=${foo##*-} + toc_find_failok $key + toc_add_make $var="${TOC_FIND_RESULT}" +done + toc_add_make INCLUDES="$INCLUDES" toc_add_make CPPFLAGS="$CPPFLAGS" Index: qt_if_enabled.sh =================================================================== RCS file: /cvsroot/libfunutil/libfunutil/toc/tests/qt_if_enabled.sh,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- qt_if_enabled.sh 30 Aug 2003 19:20:31 -0000 1.4 +++ qt_if_enabled.sh 27 Sep 2003 22:34:03 -0000 1.5 @@ -1,4 +1,40 @@ +#!/do/not/sh +# toc_run_description = checking whether to use Qt +# toc_begin_help = +# This test does not actually check for qt - it checks +# to see whether running the qt test is desired, then +# runs that test if it thinks it should. All arguments +# are passed on to the qt test (if it is run), so +# see that test for information on what arguments +# are required. +# +# If --without-qt is used then this test does not check for qt and +# returns zero. +# +# The qt test is invoked in any of the following cases: +# +# --with-qt is not zero +# +# --with-QTDIR=/path/to/qt +# +# --with-QTDIR and ${QTDIR} points to /path/to/qt +# +# Sets these config vars: +# +# - HAVE_QT: zero or one +# +# Others will be set by the qt test if it is run. +# +# Returns one of: +# +# - zero if none of the above conditions are met. +# +# - one if, e.g., --with-qt is passed but no QTDIR is set, or +# --with-QTDIR=/path points to an invalid path. +# +# - return code from the qt test. +# = toc_end_help toc_add_config_h HAVE_QT=0 toc_add_make configure_with_qt=${configure_with_qt-0} @@ -7,7 +43,7 @@ return 0 } use_qt=${configure_with_qt-0} -test "x${configure_with_QTDIR}" = "x1" && configure_with_QTDIR=$QTDIR +test "x${configure_with_QTDIR}" = "x1" && configure_with_QTDIR="$QTDIR" test "x${configure_with_QTDIR}" != "x" && { thedir="${configure_with_QTDIR}" test -d "$thedir" || { @@ -27,7 +63,7 @@ qt_required_version=${qt_required_version-'3.x'} qt_required_version_glob=${qt_required_version_glob-'3.*'} -toc_source_test qt $@ || { +toc_source_test qt "$@" || { err=$? echo "Qt $qt_required_version not found." return $err Index: readline.sh =================================================================== RCS file: /cvsroot/libfunutil/libfunutil/toc/tests/readline.sh,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- readline.sh 31 Aug 2003 21:38:35 -0000 1.8 +++ readline.sh 27 Sep 2003 22:34:03 -0000 1.9 @@ -1,31 +1,33 @@ -# a basic toc test for libreadline. +# toc_run_description = looking for libreadline/libhistory # toc_begin_help = # Searches for GNU libreadline. -# Use --with-libreadline to enable it. -# Sets the LIBREADLINE_LDADD make var and the HAVE_READLINE config.h var. # -# Sample snippet for your shared makefile: +#Sets the LIBREADLINE_LDADD make var and the HAVE_READLINE config.h var. # -# configure_with_libreadline = @configure_with_libreadline@ -# ifeq (1,$(configure_with_libreadline)) -# LIBREADLINE_LDADD = @LIBREADLINE_LDADD@ -# endif +#Use --without-libreadline to explicitely disable libreadline support. # -# And for client makefiles: -# ifeq (1,$(configure_with_libreadline)) -# my_LDADD += $(LIBREADLINE_LDADD) -# endif +#Sample snippet for your shared makefile: +# +# configure_with_libreadline = @configure_with_libreadline@ +# LIBREADLINE_LDADD = @LIBREADLINE_LDADD@ +# +#And for client makefiles: +# +# ifeq (1,$(configure_with_libreadline)) +# my_LDADD += $(LIBREADLINE_LDADD) +# endif # # In your config.h.at put something like: # -# #define HAVE_READLINE @HAVE_READLINE@ +# #define HAVE_READLINE @HAVE_READLINE@ +# # = toc_end_help toc_add_config_h HAVE_READLINE=0 toc_add_make configure_with_libreadline=0 toc_add_make LIBREADLINE_LDADD= -test "${configure_with_libreadline}" = "0" && { +test "x${configure_with_libreadline}" = "x0" && { echo "libreadline has been explictely disabled with --without-readline." return 0 } @@ -38,6 +40,7 @@ return 1 } lib=${TOC_FIND_RESULT} + incpath=/usr/include:/usr/include/readline:/usr/local/include:/usr/local/include/readline:${prefix}/include:${prefix}/include/readline for inc in readline.h history.h; do toc_find_failok $inc $incpath || { @@ -48,21 +51,24 @@ done LIBREADLINE_LDADD="-lreadline" nc=-lncurses -if toc_find_failok nm > /dev/null; then -# echo -n "? Do we also need to link against $nc? ... " - if ${TOC_FIND_RESULT} ${lib} | grep -q tgoto; then - true - else - echo "It seems we also need to link against $n." - LIBREADLINE_LDADD="${LIBREADLINE_LDADD} $nc" - fi -else - echo "Couldn't find 'nm' to check $lib with, so i'm going to assume we need $nc." + +# note, this grep is apparenlty not sufficient, so i'm going +# to assume the readline needs ncurses for now. :/ +#if toc_find_failok nm > /dev/null; then +## echo -n "? Do we also need to link against $nc? ... " +# if ${TOC_FIND_RESULT} ${lib} | grep -q tgoto; then +# true +# else +# echo "It seems we also need to link against $n." +# LIBREADLINE_LDADD="${LIBREADLINE_LDADD} $nc" +# fi +#else +# echo "Couldn't find 'nm' to check $lib with, so i'm going to assume we need $nc." LIBREADLINE_LDADD="${LIBREADLINE_LDADD} $nc" -fi +#fi configure_with_libreadline=1 toc_add_config_h HAVE_READLINE=1 toc_add_make configure_with_libreadline=1 toc_add_make LIBREADLINE_LDADD="${LIBREADLINE_LDADD}" -return 0 \ No newline at end of file +return 0 Index: toc_core_tests.sh =================================================================== RCS file: /cvsroot/libfunutil/libfunutil/toc/tests/toc_core_tests.sh,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- toc_core_tests.sh 5 Sep 2003 09:34:54 -0000 1.9 +++ toc_core_tests.sh 27 Sep 2003 22:34:03 -0000 1.10 @@ -1,15 +1,16 @@ -# toc_run_description = core sanity checks -# to be sourced from toc_core.sh -# This is the core sanity checker for toc. Any test which MUST -# pass for a tree to be considered toc-capable may be placed -# in here. +# toc_run_description = Looking for required build components... +# toc_begin_help = +# To be sourced from toc_core.sh. This is the core sanity checker for +# toc. Any test which MUST pass for a tree to be considered +# toc-capable may be placed in here. +# = toc_end_help -toc_quietly "Required components:" +toc_run running_under_cygwin +# toc_quietly "Looking for required build components:" for x in \ bash=SHELL \ cat=CAT \ cut=CUT \ - gzip=GZIP \ ls=LS \ perl=PERL \ sed=SED \ @@ -32,8 +33,10 @@ toc_find_fail install-sh ${TOC_TOCDIR}/bin toc_add_make INSTALLER_BIN="\$(top_srcdir)/${TOC_FIND_RESULT##${PWD}/}" + toc_find_fail makedist ${TOC_TOCDIR}/bin toc_add_make TOC_MAKEDIST_BIN="\$(top_srcdir)/${TOC_FIND_RESULT##${PWD}/}" +# it's very arguable to make makedist a required component :/ for x in \ awk \ @@ -41,25 +44,25 @@ gnu_find \ gnu_tar \ ; do - toc_source_test $x || { - echo "required test $x failed." + toc_run_failok $x || { + echo "${TOC_EMOTICON_ERROR} $x test failed." return 1 } done -toc_run running_under_cygwin - #toc_run_failok gnu_install || { # boldecho "Didn't find GNU install. You won't be able to do a 'make install'." #} -toc_quietly "Optional components:" +toc_quietly "Looking for optional build components:" for x in \ + gzip=GZIP \ bzip2=BZIP \ zip=ZIP \ ; do f=${x%%=*} v=${x##*=} + foo=configure_with_${f} toc_find_failok $f toc_add_make $v=${TOC_FIND_RESULT} done Index: toc_project_makefile.sh =================================================================== RCS file: /cvsroot/libfunutil/libfunutil/toc/tests/toc_project_makefile.sh,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- toc_project_makefile.sh 26 Aug 2003 08:31:28 -0000 1.4 +++ toc_project_makefile.sh 27 Sep 2003 22:34:03 -0000 1.5 @@ -1,3 +1,4 @@ +# toc_run_description = looking for toc.${PACKAGE_NAME}.make.at # Creates toc.${PACKAGE_NAME}.make from toc.${PACKAGE_NAME}.make.at # This file is sought by toc.make (but is always optional) |
From: <sg...@us...> - 2003-09-27 22:34:22
|
Update of /cvsroot/libfunutil/libfunutil/toc/make In directory sc8-pr-cvs1:/tmp/cvs-serv7115/toc/make Added Files: symlink_headers.make Log Message: egg --- NEW FILE: symlink_headers.make --- # snippet to symlink header files to a common includes dir. # Usage: # SYMLINK_HEADERS = $(wildcard *.h) # SYMLINK_HEADERS_DEST = $(top_srcdir)/include/whereever # include $(toc_makesdir)/symlink_headers.make # run: # all: symlink-headers # # The headers are cleaned up during clean/distclean. ifneq (,$(SYMLINK_HEADERS)) ifeq (,$(SYMLINK_HEADERS_DEST)) $(error You must define both SYMLINK_HEADERS and SYMLINK_HEADERS_DEST to use this snippet.) endif symlink-headers: FORCE @$(call toc_make_install_symlink,$(SYMLINK_HEADERS),$(SYMLINK_HEADERS_DEST),-m 0644) symlink-headers-clean: FORCE @echo "Cleaning headers." @-touch foo.cleanlocal; rm foo.cleanlocal $(wildcard $(addprefix $(SYMLINK_HEADERS_DEST)/,$(SYMLINK_HEADERS))) clean: symlink-headers-clean distclean: symlink-headers-clean endif |
From: <sg...@us...> - 2003-09-27 22:33:59
|
Update of /cvsroot/libfunutil/libfunutil In directory sc8-pr-cvs1:/tmp/cvs-serv7044 Added Files: toc.libfunUtil.help Log Message: egg --- NEW FILE: toc.libfunUtil.help --- --enable-s11n Enables the highly-experimental s11n library (see lib/s11n and tests/s11n). |
From: <sg...@us...> - 2003-09-27 17:01:18
|
Update of /cvsroot/libfunutil/libfunutil/lib/funUtil In directory sc8-pr-cvs1:/tmp/cvs-serv922 Modified Files: SimpleCLParser.cpp Log Message: fixed a long-standing memory leak: it was not releasing the help descriptions map. Index: SimpleCLParser.cpp =================================================================== RCS file: /cvsroot/libfunutil/libfunutil/lib/funUtil/SimpleCLParser.cpp,v retrieving revision 1.24 retrieving revision 1.25 diff -u -d -r1.24 -r1.25 --- SimpleCLParser.cpp 16 Aug 2003 20:59:18 -0000 1.24 +++ SimpleCLParser.cpp 27 Sep 2003 16:01:21 -0000 1.25 @@ -43,6 +43,7 @@ SimpleCLParser::~SimpleCLParser() { + delete( this->descr ); } int |
From: stephan b. <st...@ei...> - 2003-09-05 11:36:23
|
okay, i've gotten carried away... the ser-txt parser can now handle a more useful superset of the txt format. Here's an example which shows the current possibilities: /* comment block */ // single-line comment # single-line comment ; single-line comment myfoo class=FooClass { gameboxName G.E.V. gameboxVers = 0.1 // ^^^ optional = sign for property declarations. mybar class=BarClass { myprop 17 myotherprop "this string here, seen?" /*********** we don't serve their kind here: ohno class=NoExistie { canyouinstantiateme = no canyouinstantiateme2 = no2 canyouinstantiateme3 = no3 } ohno class=NoExistie { canyouinstantiateme = no } ohno class=NoExistie { canyouinstantiateme = no } ***********/ } }; # ^^^ optional trailing semicolon root_too class=FooClass { the_real_node #42.42 # strings: backslashes and outer quotes will get # stripped and newlines normalized: quoted_string="this is a quoted string" unquoted_string this is an unquoted string squoted_string 'this is a \ single-quoted \ string' mstring "this is a \ \"multi-line\" \ string" another semi-colon val; key = semi-colon val; # semicolon gets stripped. SOURCES = foo \ elib_globals.cpp \ ECommandLiner.cpp \ EInputProcessor.cpp \ EEnvironment.cpp \ EInputProcessorChain.cpp \ EInputDispatcher.cpp \ EKeyValueParser.cpp \ ELib.cpp \ EPointerList.cpp \ ESimpleCLParser.cpp \ EStdStringTokenizer.cpp \ EStringTokenizer.cpp \ EPathFinder.cpp \ EPropertyList.cpp \ EReadline.cpp \ EShellProcess.cpp \ EStringList.cpp } possible todos: add protocol level check for, e.g.: #SerialTree text_v2 nodename class=Foo X where X is some positive integer - the object would be replicated that number of times. # nodename class=Foo comment out the whole node if the node decl is commented out. i'll check this into the fun tree once i'm happy with it. The code does not yet build a proper tree (i'm using property lists for everything at the moment), but the parser is agnostic in regards to the tree structure, using a set of 3 callbacks to open/close nodes and add props to the current node. -- ----- stephan st...@ei... - http://www.einsurance.de "...control is a degree of inhibition, and a system which is perfectly inhibited is completely frozen." -- Alan W. Watts |
From: stephan b. <st...@ei...> - 2003-09-05 09:44:03
|
On Friday 05 September 2003 10:43, stephan beal wrote: > On Friday 05 September 2003 07:41, bo...@us... wrote: > > # No spaces in the PACKAGE_NAME and _VERSION, please - this should > > be # as filesystem-friendly as possible. export > > > > -PACKAGE_NAME=libfunutil > > +PACKAGE_NAME=libfunUtil Fixed: i've added the optional var PACKAGE_CONFIGURE_SCRIPT, which should be set (if set at all) in configure, before toconfigure is sourced. This var supercedes the default of configure.$PACKAGE_NAME. -- ----- stephan st...@ei... - http://www.einsurance.de "...control is a degree of inhibition, and a system which is perfectly inhibited is completely frozen." -- Alan W. Watts |
From: <sg...@us...> - 2003-09-05 09:35:32
|
Update of /cvsroot/libfunutil/libfunutil/toc/make In directory sc8-pr-cvs1:/tmp/cvs-serv25087/toc/make Added Files: flex.make Log Message: egg --- NEW FILE: flex.make --- #!make # snippet to compile .flex files into .cpp # usage: # define: # FLEXES = foo bar # all: flex_files # You must have foo.flex for each $(FLEXES) and foo.flex.cpp will # be generated. It will be "massaged" a bit to allow it to compile # under newer GCC versions (3.2+ish, i think). FLEX_CPPFILE_SUFFIX = .cpp FLEX_FILE_SUFFIX ?= .flex %$(FLEX_FILE_SUFFIX):# undefine make's implicite rule FLEX_MAKEFILE = $(toc_makesdir)/flex.make ifneq (,$(FLEXES)) FLEX_BIN = $(firstword $(wildcard $(addsuffix /flex,$(subst :, ,$(PATH))))) ifeq (,$(FLEX_BIN)) $(error This makefile snippet requires that 'flex' be found in the PATH!) endif FLEX_FLEX_FILES = $(addsuffix $(FLEX_FILE_SUFFIX),$(FLEXES)) FLEX_CPP_FILES = $(addsuffix $(FLEX_CPPFILE_SUFFIX),$(FLEX_FLEX_FILES)) # $(FLEX_FLEX_FILES): Makefile # %.flex: Makefile %$(FLEX_FILE_SUFFIX)$(FLEX_CPPFILE_SUFFIX): %$(FLEX_FILE_SUFFIX) $(FLEX_MAKEFILE) Makefile @echo "Flexing $< to $@, plus doing iostream hacks :/."; \ flex -+ -t $< | \ perl -p \ -e 's/iostream\.h/iostream/;' \ -e 'next if m/iostream/;' \ -e 'next if m/::[io]stream/;' \ -e 's/(ostream|istream)([^\.])/std::$$1$$2/g;' > $@ CLEAN_FILES += $(FLEX_CPP_FILES) flexes: $(FLEX_CPP_FILES) else flexes: endif |
From: <sg...@us...> - 2003-09-05 09:34:57
|
Update of /cvsroot/libfunutil/libfunutil/toc/tests In directory sc8-pr-cvs1:/tmp/cvs-serv24961/toc/tests Modified Files: toc_core_tests.sh Log Message: Now looks for more|less instead of just more. Index: toc_core_tests.sh =================================================================== RCS file: /cvsroot/libfunutil/libfunutil/toc/tests/toc_core_tests.sh,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- toc_core_tests.sh 31 Aug 2003 00:43:05 -0000 1.8 +++ toc_core_tests.sh 5 Sep 2003 09:34:54 -0000 1.9 @@ -11,7 +11,6 @@ cut=CUT \ gzip=GZIP \ ls=LS \ - more=XtocX \ perl=PERL \ sed=SED \ xargs=XARGS \ @@ -25,6 +24,11 @@ test "x$v" = "xXtocX" && continue toc_add_make $v=${TOC_FIND_RESULT} done + +toc_find_failok less || toc_find_failok more || { + echo "Found neither 'more' nor 'less'!!!" + return 1 +} toc_find_fail install-sh ${TOC_TOCDIR}/bin toc_add_make INSTALLER_BIN="\$(top_srcdir)/${TOC_FIND_RESULT##${PWD}/}" |
From: <sg...@us...> - 2003-09-05 09:34:04
|
Update of /cvsroot/libfunutil/libfunutil/toc/tests In directory sc8-pr-cvs1:/tmp/cvs-serv24814/toc/tests Modified Files: gnu_cpp_tools.sh Log Message: Now sets NDEBUG if --enable-debug. Index: gnu_cpp_tools.sh =================================================================== RCS file: /cvsroot/libfunutil/libfunutil/toc/tests/gnu_cpp_tools.sh,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- gnu_cpp_tools.sh 31 Aug 2003 21:38:01 -0000 1.9 +++ gnu_cpp_tools.sh 5 Sep 2003 09:34:00 -0000 1.10 @@ -4,6 +4,7 @@ # --enable-debug causes stuff to be built -g instead of -02. This is a # little weird, but you can control the optimization level # with --enable-debug="-O3 -fno-inline" etc. +# --enable-debug (without arguments) also sets -DNDEBUG=1. # --enable-warn causes stuff to be built -Wall. To turn on -Werror, go # --enable-warn="-Wall -Werror" etc. # --enable-werror same as --enable-warn="-Wall -Werror" @@ -13,7 +14,7 @@ # - INCLUDES probably empty # - CPPFLAGS probably empty # - OPT -g or -O2 (or some other value specified by --enable-debug) -# - WARN -Wall (or some other value specified by --enable-warn) +# - WARN -Wall (or some other value specified by --enable-warn or --enable-werror) # - CFLAGS probably empty (or maybe -pipe) # - CXXFLAGS probably empty (or maybe -pipe) # - LDFLAGS probably empty @@ -35,9 +36,8 @@ toc_add_make INCLUDES="$INCLUDES" toc_add_make CPPFLAGS="$CPPFLAGS" - if test "$configure_enable_debug" = 1; then - OPT="-g $OPT" + OPT="-g $OPT -DNDEBUG=1" elif test "${configure_enable_debug:-0}" = 0; then # What's a sensible default here? -O2? Put it first in the hopes # that any values already in $OPT will take precedence. |
From: <sg...@us...> - 2003-09-05 09:33:51
|
Update of /cvsroot/libfunutil/libfunutil/toc/sbin In directory sc8-pr-cvs1:/tmp/cvs-serv24792/toc/sbin Modified Files: toc_core.sh Log Message: Two quoting fixes. Moved the help check test to before the core checks, and made it silent. Index: toc_core.sh =================================================================== RCS file: /cvsroot/libfunutil/libfunutil/toc/sbin/toc_core.sh,v retrieving revision 1.25 retrieving revision 1.26 diff -u -d -r1.25 -r1.26 --- toc_core.sh 31 Aug 2003 21:36:00 -0000 1.25 +++ toc_core.sh 5 Sep 2003 09:33:48 -0000 1.26 @@ -116,7 +116,7 @@ # returns 1 if it does not output anything test "x${TOC_QUIET-0}" != "x0" && return 1 test -n "$1" && { - echo $@ + echo "$@" return 0 } cat @@ -128,7 +128,7 @@ # returns 1 if it does not output anything test "x${TOC_LOUD-0}" = "x0" && return 1 test -n "$1" && { - echo $@ + echo "$@" return 0 } cat @@ -780,11 +780,12 @@ # We do some initial sanity checking here, # but any tree-specific checks must be done from configure. -echo "Configuring build environment." toc_parseargs --prefix=${prefix} "$@" toc_loudly 'Loud mode enabled.' -toc_run_fail toc_tests_help +toc_source_test toc_tests_help || exit 0 + +echo "Configuring build environment." toc_quietly <<-EOF ${TOC_BOLD_}Emoticon legend:${_TOC_BOLD} |