From: stephan b. <sg...@us...> - 2004-12-28 01:10:58
|
Update of /cvsroot/pclasses/pclasses2/src/s11n/proxy In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16739 Modified Files: createRegSerTraits.sh Log Message: added -list and -map shortcuts. Index: createRegSerTraits.sh =================================================================== RCS file: /cvsroot/pclasses/pclasses2/src/s11n/proxy/createRegSerTraits.sh,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- createRegSerTraits.sh 28 Dec 2004 00:54:04 -0000 1.1 +++ createRegSerTraits.sh 28 Dec 2004 01:10:47 -0000 1.2 @@ -1,5 +1,7 @@ #!/bin/bash +# Docs are below... +######################################################################## function show_help() { cat <<EOF @@ -38,11 +40,39 @@ -ns namespace_of_s11n [${o_sns}] An obscure option to help me port code between pclasses.com::s11n and s11n.net::s11n. + If used, this option needs to be as early + in the args list as possible (BUG: must come + before any options which rely on the namespace). e.g.: -ns P::s11n + -list + SerializableClass is compatible with the + std::list proxy, and should use it. + The -p option will trump the default list + proxy, making this a no-op if -p is used. + + -list-ios + Like -list, but use a proxy optimized for use + with a container of an i/ostreamable type. + + -map + Like -list, but applies to map-compatible types. + + -map-ios + Like -list-ios, but for maps. Both key and value types + must be i/ostreamable. + EOF } # show_help() +o_sns="::P::s11n" # must unfortunately have default val up here. +# proxy vars: yes, the single-quotes are intentional +i_proxy_list='${o_sns}::list::list_serializable_proxy' +i_proxy_list_s='${o_sns}::list::streamable_list_serializable_proxy' +i_proxy_map='${o_sns}::map::map_serializable_proxy' +i_proxy_map_s='${o_sns}::map::streamable_map_serializable_proxy' + + ############################## args parsing... while test x != "x$1"; do a=$1 @@ -81,9 +111,28 @@ shift continue ;; + -list) + : ${o_proxy="$(eval echo ${i_proxy_list})"} + continue + ;; + -list-ios) + : ${o_proxy="$(eval echo ${i_proxy_list_s})"} + continue + ;; + -map) + : ${o_proxy="$(eval echo ${i_proxy_map})"} + continue + ;; + -map-ios) + : ${o_proxy="$(eval echo ${i_proxy_map_s})"} + continue + ;; -?|--help|-h) o_show_help=1 - cotinue + # We collect all the args before showing help + # so we can show them in context in the help + # text. + continue ;; *) echo "Unknown argument: $a" @@ -91,12 +140,14 @@ esac done +############################## arg defaults... : ${o_abstract=0} -: ${o_sns="::P::s11n"} : ${o_proxy="${o_sns}::default_serialize_functor"} : ${o_clname="${o_class}"} : ${o_base=${o_class}} : ${o_reg_h="<pclasses/s11n/reg_serializable_traits.h>"} +: ${o_show_help=0} + test x1 = "x${o_show_help}" && { @@ -109,10 +160,10 @@ exit 1 } # end usage text -# getopt "c:" "$@" +do_proxy_reg=1 -test x != "x${o_class}" && { +test x1 = "x${do_proxy_reg}" && { # Note the use of HARD TABS in the <<-EOF!!! cat <<-EOF |