Compare commits

..

1 Commits

Author SHA1 Message Date
Beman Dawes
82c340d49f v2, v3, integration branch
[SVN r62649]
2010-06-09 11:34:33 +00:00
21 changed files with 25 additions and 112 deletions

View File

@@ -12,8 +12,6 @@ SOURCES =
lib boost_program_options
: $(SOURCES).cpp
: <link>shared:<define>BOOST_PROGRAM_OPTIONS_DYN_LINK=1 # tell source we're building dll's
# See https://svn.boost.org/trac/boost/ticket/5049
<target-os>hpux,<toolset>gcc:<define>_INCLUDE_STDC__SOURCE_199901
:
: <link>shared:<define>BOOST_PROGRAM_OPTIONS_DYN_LINK=1
;

View File

@@ -5,7 +5,6 @@ toolset.using doxygen ;
boostbook program_option
: program_options.xml
: <implicit-dependency>autodoc
<xsl:param>boost.root=../../../..
<format>pdf:<xsl:param>boost.url.prefix=http://www.boost.org/doc/libs/release/doc/html
;

View File

@@ -115,8 +115,7 @@ if (vm.count("response-file")) {
ss << ifs.rdbuf();
// Split the file content
char_separator<char> sep(" \n\r");
std::string ResponsefileContents( ss.str() );
tokenizer<char_separator<char> > tok(ResponsefileContents, sep);
tokenizer<char_separator<char> > tok(ss.str(), sep);
vector<string> args;
copy(tok.begin(), tok.end(), back_inserter(args));
// Parse the file and store the options
@@ -296,7 +295,7 @@ void validate(boost::any& v,
if (regex_match(s, match, r)) {
v = any(magic_number(lexical_cast<int>(match[1])));
} else {
throw validation_error(validation_error::invalid_option_value);
throw validation_error("invalid value");
}
}
]]>

View File

@@ -181,7 +181,7 @@ options_description desc;
desc.add_options()
("help", "produce help message")
("compression", value&lt;string&gt;(), "compression level")
("verbose", value&lt;string&gt;()->implicit_value("0"), "verbosity level")
("verbose", value&lt;string&gt;()->zero_tokens(), "verbosity level")
("email", value&lt;string&gt;()->multitoken(), "email to send to")
;
</programlisting>

View File

@@ -29,7 +29,7 @@ int main(int ac, char* av[])
if (vm.count("help")) {
cout << desc << "\n";
return 0;
return 1;
}
if (vm.count("compression")) {

View File

@@ -34,14 +34,17 @@
#endif // BOOST_VERSION
///////////////////////////////////////////////////////////////////////////////
// Windows DLL suport
#ifdef BOOST_HAS_DECLSPEC
#if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_PROGRAM_OPTIONS_DYN_LINK)
// export if this is our own source, otherwise import:
#ifdef BOOST_PROGRAM_OPTIONS_SOURCE
# define BOOST_PROGRAM_OPTIONS_DECL BOOST_SYMBOL_EXPORT
# define BOOST_PROGRAM_OPTIONS_DECL __declspec(dllexport)
#else
# define BOOST_PROGRAM_OPTIONS_DECL BOOST_SYMBOL_IMPORT
# define BOOST_PROGRAM_OPTIONS_DECL __declspec(dllimport)
#endif // BOOST_PROGRAM_OPTIONS_SOURCE
#endif // DYN_LINK
#endif // BOOST_HAS_DECLSPEC
#ifndef BOOST_PROGRAM_OPTIONS_DECL
#define BOOST_PROGRAM_OPTIONS_DECL

View File

@@ -22,11 +22,6 @@
#include <string>
#include <vector>
#if defined(BOOST_MSVC)
# pragma warning (push)
# pragma warning (disable:4251) // class 'std::vector<_Ty>' needs to have dll-interface to be used by clients of class 'boost::program_options::positional_options_description'
#endif
namespace boost { namespace program_options { namespace detail {
/** Command line parser class. Main requirements were:
@@ -139,9 +134,5 @@ namespace boost { namespace program_options { namespace detail {
}}}
#if defined(BOOST_MSVC)
# pragma warning (pop)
#endif
#endif

View File

@@ -36,11 +36,11 @@ namespace boost { namespace program_options {
template<class charT>
basic_command_line_parser<charT>::
basic_command_line_parser(int argc, const charT* const argv[])
basic_command_line_parser(int argc, charT* argv[])
: detail::cmdline(
// Explicit template arguments are required by gcc 3.3.1
// (at least mingw version), and do no harm on other compilers.
to_internal(detail::make_vector<charT, const charT* const*>(argv+1, argv+argc+!argc)))
to_internal(detail::make_vector<charT, charT**>(argv+1, argv+argc+!argc)))
{}
@@ -111,7 +111,7 @@ namespace boost { namespace program_options {
template<class charT>
basic_parsed_options<charT>
parse_command_line(int argc, const charT* const argv[],
parse_command_line(int argc, charT* argv[],
const options_description& desc,
int style,
function1<std::pair<std::string, std::string>,

View File

@@ -13,11 +13,7 @@
#include <stdexcept>
#include <vector>
#if defined(BOOST_MSVC)
# pragma warning (push)
# pragma warning (disable:4275) // non dll-interface class 'std::logic_error' used as base for dll-interface class 'boost::program_options::error'
# pragma warning (disable:4251) // class 'std::vector<_Ty>' needs to have dll-interface to be used by clients of class 'boost::program_options::ambiguous_option'
#endif
namespace boost { namespace program_options {
@@ -236,8 +232,5 @@ namespace boost { namespace program_options {
};
}}
#if defined(BOOST_MSVC)
# pragma warning (pop)
#endif
#endif

View File

@@ -25,12 +25,6 @@
#include <iosfwd>
#if defined(BOOST_MSVC)
# pragma warning (push)
# pragma warning (disable:4251) // class 'boost::shared_ptr<T>' needs to have dll-interface to be used by clients of class 'boost::program_options::option_description'
#endif
/** Boost namespace */
namespace boost {
/** Namespace for the library. */
@@ -257,8 +251,4 @@ namespace program_options {
};
}}
#if defined(BOOST_MSVC)
# pragma warning (pop)
#endif
#endif

View File

@@ -17,11 +17,6 @@
#include <vector>
#include <utility>
#if defined(BOOST_MSVC)
# pragma warning (push)
# pragma warning (disable:4251) // class 'std::vector<_Ty>' needs to have dll-interface to be used by clients of class 'boost::program_options::basic_parsed_options<wchar_t>'
#endif
namespace boost { namespace program_options {
class options_description;
@@ -100,7 +95,7 @@ namespace boost { namespace program_options {
/** Creates a command line parser for the specified arguments
list. The parameters should be the same as passed to 'main'.
*/
basic_command_line_parser(int argc, const charT* const argv[]);
basic_command_line_parser(int argc, charT* argv[]);
/** Sets options descriptions to use. */
basic_command_line_parser& options(const options_description& desc);
@@ -144,7 +139,7 @@ namespace boost { namespace program_options {
*/
template<class charT>
basic_parsed_options<charT>
parse_command_line(int argc, const charT* const argv[],
parse_command_line(int argc, charT* argv[],
const options_description&,
int style = 0,
function1<std::pair<std::string, std::string>,
@@ -260,10 +255,6 @@ namespace boost { namespace program_options {
}}
#if defined(BOOST_MSVC)
# pragma warning (pop)
#endif
#undef DECL
#include "boost/program_options/detail/parsers.hpp"

View File

@@ -11,11 +11,6 @@
#include <vector>
#include <string>
#if defined(BOOST_MSVC)
# pragma warning (push)
# pragma warning (disable:4251) // class 'std::vector<_Ty>' needs to have dll-interface to be used by clients of class 'boost::program_options::positional_options_description'
#endif
namespace boost { namespace program_options {
/** Describes positional options.
@@ -66,9 +61,5 @@ namespace boost { namespace program_options {
}}
#if defined(BOOST_MSVC)
# pragma warning (pop)
#endif
#endif

View File

@@ -261,21 +261,13 @@ namespace boost { namespace program_options {
return this;
}
/** Specifies that the value can span multiple tokens.
*/
/** Specifies that the value can span multiple tokens. */
typed_value* multitoken()
{
m_multitoken = true;
return this;
}
/** Specifies that no tokens may be provided as the value of
this option, which means that only presense of the option
is significant. For such option to be useful, either the
'validate' function should be specialized, or the
'implicit_value' method should be also used. In most
cases, you can use the 'bool_switch' function instead of
using this method. */
typed_value* zero_tokens()
{
m_zero_tokens = true;

View File

@@ -16,11 +16,6 @@
#include <map>
#include <set>
#if defined(BOOST_MSVC)
# pragma warning (push)
# pragma warning (disable:4251) // 'boost::program_options::variable_value::v' : class 'boost::any' needs to have dll-interface to be used by clients of class 'boost::program_options::variable_value
#endif
namespace boost { namespace program_options {
template<class charT>
@@ -153,9 +148,6 @@ namespace boost { namespace program_options {
// Resolve conflict between inherited operators.
const variable_value& operator[](const std::string& name) const
{ return abstract_variables_map::operator[](name); }
// Override to clear some extra fields.
void clear();
void notify();
@@ -211,8 +203,4 @@ namespace boost { namespace program_options {
}}
#if defined(BOOST_MSVC)
# pragma warning (pop)
#endif
#endif

View File

@@ -277,7 +277,7 @@ namespace boost { namespace program_options { namespace detail {
}
/* If an key option is followed by a positional option,
can can consume more tokens (e.g. it's multitoken option),
can can consume more tokens (e.g. it's multitoke option),
give those tokens to it. */
vector<option> result2;
for (unsigned i = 0; i < result.size(); ++i)

View File

@@ -174,13 +174,10 @@ namespace boost { namespace program_options {
option_description::format_name() const
{
if (!m_short_name.empty())
{
return m_long_name.empty()
? m_short_name
: string(m_short_name).append(" [ --").
append(m_long_name).append(" ]");
}
return string("--").append(m_long_name);
return string(m_short_name).append(" [ --").
append(m_long_name).append(" ]");
else
return string("--").append(m_long_name);
}
std::string

View File

@@ -45,10 +45,7 @@
// See: http://article.gmane.org/gmane.comp.lib.boost.devel/103843
// See: http://lists.gnu.org/archive/html/bug-guile/2004-01/msg00013.html
#if defined(__APPLE__) && defined(__DYNAMIC__)
// The proper include for this is crt_externs.h, however it's not
// available on iOS. The right replacement is not known. See
// https://svn.boost.org/trac/boost/ticket/5053
extern "C" { extern char ***_NSGetEnviron(void); }
#include <crt_externs.h>
#define environ (*_NSGetEnviron())
#else
#if defined(__MWERKS__)

View File

@@ -182,13 +182,6 @@ namespace boost { namespace program_options {
: abstract_variables_map(next)
{}
void variables_map::clear()
{
std::map<std::string, variable_value>::clear();
m_final.clear();
m_required.clear();
}
const variable_value&
variables_map::get(const std::string& name) const
{

View File

@@ -378,15 +378,6 @@ void test_guessing()
{0, 0, 0}
};
test_cmdline("opt123 opt56 foo,f=", style, test_cases1);
test_case test_cases2[] = {
{"--fname file --fname2 file2", s_success, "fname: file fname2: file2"},
{"--fnam file --fnam file2", s_ambiguous_option, ""},
{"--fnam file --fname2 file2", s_ambiguous_option, ""},
{"--fname2 file2 --fnam file", s_ambiguous_option, ""},
{0, 0, 0}
};
test_cmdline("fname fname2", style, test_cases2);
}
void test_arguments()

View File

@@ -131,7 +131,7 @@ void test_command_line()
// Regression test: check that '0' as style is interpreted as
// 'default_style'
vector<option> a4 =
parse_command_line(sizeof(cmdline3_)/sizeof(const char*), cmdline3_,
parse_command_line(sizeof(cmdline3_)/sizeof(const char*), const_cast<char**>(cmdline3_),
desc, 0, additional_parser).options;
BOOST_CHECK_EQUAL(a4.size(), 4u);

View File

@@ -21,7 +21,7 @@ void do_it()
f.write("(\"opt%d\", value<int>())\n")
f.write(";\n}\n")
f.close()
os.system(compiler_command + " -c -save-temps -I /home/ghost/Work/Boost/boost-svn program_options_test.cpp")
os.system(compiler_command + " -c -save-temps -I /home/ghost/Work/boost-rc program_options_test.cpp")
nm = os.popen("nm -S program_options_test.o")
for l in nm:
@@ -45,7 +45,7 @@ def run_tests(range, compiler_command):
print "Avarage: ", (last_size-first_size)/(range[-1]-range[0])
if __name__ == '__main__':
for compiler in [ "g++ -Os", "g++ -O3"]:
for compiler in [ "g++-3.3 -Os", "g++-3.3 -O3", "g++-3.4 -Os", "g++-3.4 -O3"]:
print "****", compiler, "****"
run_tests(range(1, 20), compiler)